Merge branch 'develop' into working
Some checks failed
release-dev / release-dev (push) Failing after 13s
Some checks failed
release-dev / release-dev (push) Failing after 13s
This commit is contained in:
commit
7098a8620d
9 changed files with 20173 additions and 3 deletions
|
|
@ -3,6 +3,11 @@ using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
{
|
{
|
||||||
|
|
@ -11,15 +16,25 @@ namespace BMA.EHR.Application.Repositories
|
||||||
private readonly IApplicationDBContext _dbContext;
|
private readonly IApplicationDBContext _dbContext;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly NotificationRepository _repositoryNoti;
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
public RetirementRepository(IApplicationDBContext dbContext,
|
public RetirementRepository(IApplicationDBContext dbContext,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
//ปลดออก
|
//ปลดออก
|
||||||
public async Task NotifyDischarge()
|
public async Task NotifyDischarge()
|
||||||
{
|
{
|
||||||
|
|
@ -88,5 +103,44 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
await _dbContext.SaveChangesAsync();
|
await _dbContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//เกษียณอายุราชการ
|
||||||
|
public async Task ExecuteRetirement()
|
||||||
|
{
|
||||||
|
var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||||
|
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||||
|
.Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
||||||
|
.Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
var body = retirePeriodOfficer.RetirementProfiles
|
||||||
|
.Select(x => new {
|
||||||
|
profileId = x.profileId,
|
||||||
|
//lastUpdateUserId = UserId,
|
||||||
|
//lastUpdateFullName = FullName,
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//ข้าราชการ
|
||||||
|
//var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||||
|
var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
|
var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||||
|
{
|
||||||
|
Content = content
|
||||||
|
};
|
||||||
|
var response = await client.SendAsync(_req);
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,7 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัติบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบำเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕";
|
public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัติบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบำเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕";
|
||||||
public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>();
|
public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>();
|
||||||
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
|
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
|
||||||
|
public virtual List<RetirementRawProfile> RetirementRawProfiles { get; set; } = new List<RetirementRawProfile>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
80
BMA.EHR.Domain/Models/Retirement/RetirementRawProfile.cs
Normal file
80
BMA.EHR.Domain/Models/Retirement/RetirementRawProfile.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.Retirement
|
||||||
|
{
|
||||||
|
public class RetirementRawProfile : EntityBase
|
||||||
|
{
|
||||||
|
[Comment("ลำดับที่")]
|
||||||
|
public int Order { get; set; }
|
||||||
|
[Required, Comment("เหตุผล")]
|
||||||
|
public string Reason { get; set; } = string.Empty;
|
||||||
|
[Comment("ลบออกจากเกษียญ")]
|
||||||
|
public string Remove { get; set; } = "pending";
|
||||||
|
public RetirementPeriod RetirementPeriod { get; set; }
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root ")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root ")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root ")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1 ")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1 ")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1 ")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2 ")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2 ")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2 ")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3 ")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3 ")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3 ")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4 ")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4 ")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4 ")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง ")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน ")]
|
||||||
|
public string? position { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง ")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง ")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("ลำดับประเภทตำแหน่ง ")]
|
||||||
|
public int? posTypeRank { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง ")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง ")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
[Comment("ลำดับระดับตำแหน่ง ")]
|
||||||
|
public int? posLevelRank { get; set; }
|
||||||
|
[Comment("id ตำแหน่งทางการบริหาร ")]
|
||||||
|
public string? posExecutiveId { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งทางการบริหาร ")]
|
||||||
|
public string? posExecutiveName { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง ")]
|
||||||
|
public string? posNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
19507
BMA.EHR.Infrastructure/Migrations/20250128060451_add table RetirementRawProfile.Designer.cs
generated
Normal file
19507
BMA.EHR.Infrastructure/Migrations/20250128060451_add table RetirementRawProfile.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,120 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addtableRetirementRawProfile : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RetirementRawProfiles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Order = table.Column<int>(type: "int", nullable: false, comment: "ลำดับที่"),
|
||||||
|
Reason = table.Column<string>(type: "longtext", nullable: false, comment: "เหตุผล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Remove = table.Column<string>(type: "longtext", nullable: false, comment: "ลบออกจากเกษียญ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
RetirementPeriodId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
profileId = table.Column<string>(type: "longtext", nullable: true, comment: "profile Id")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
firstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
lastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
citizenId = table.Column<string>(type: "longtext", nullable: true, comment: "เลขบัตรประชาชน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
root = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน root ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
rootId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน root ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
rootShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน root ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child1 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child1 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child1Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child1 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child1ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child1 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child2 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child2 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child2Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child2 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child2ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child2 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child3 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child3 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child3Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child3 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child3ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child3 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child4 = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child4 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child4Id = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child4 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
child4ShortName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child4 ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posMasterNo = table.Column<int>(type: "int", nullable: true, comment: "เลขที่ตำแหน่ง "),
|
||||||
|
position = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อตำแหน่งในสายงาน ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posTypeId = table.Column<string>(type: "longtext", nullable: true, comment: "id ประเภทตำแหน่ง ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posTypeName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อประเภทตำแหน่ง ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posTypeRank = table.Column<int>(type: "int", nullable: true, comment: "ลำดับประเภทตำแหน่ง "),
|
||||||
|
posLevelId = table.Column<string>(type: "longtext", nullable: true, comment: "id ระดับตำแหน่ง ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posLevelName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อระดับตำแหน่ง ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posLevelRank = table.Column<int>(type: "int", nullable: true, comment: "ลำดับระดับตำแหน่ง "),
|
||||||
|
posExecutiveId = table.Column<string>(type: "longtext", nullable: true, comment: "id ตำแหน่งทางการบริหาร ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posExecutiveName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อตำแหน่งทางการบริหาร ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
posNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RetirementRawProfiles", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RetirementRawProfiles_RetirementPeriods_RetirementPeriodId",
|
||||||
|
column: x => x.RetirementPeriodId,
|
||||||
|
principalTable: "RetirementPeriods",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RetirementRawProfiles_RetirementPeriodId",
|
||||||
|
table: "RetirementRawProfiles",
|
||||||
|
column: "RetirementPeriodId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RetirementRawProfiles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15957,6 +15957,201 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.ToTable("RetirementQuestionnaireQuestions");
|
b.ToTable("RetirementQuestionnaireQuestions");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementRawProfile", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<int>("Order")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ลำดับที่");
|
||||||
|
|
||||||
|
b.Property<string>("Reason")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เหตุผล");
|
||||||
|
|
||||||
|
b.Property<string>("Remove")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ลบออกจากเกษียญ");
|
||||||
|
|
||||||
|
b.Property<Guid>("RetirementPeriodId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("child1")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อหน่วยงาน child1 ");
|
||||||
|
|
||||||
|
b.Property<string>("child1Id")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id หน่วยงาน child1 ");
|
||||||
|
|
||||||
|
b.Property<string>("child1ShortName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อย่อหน่วยงาน child1 ");
|
||||||
|
|
||||||
|
b.Property<string>("child2")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อหน่วยงาน child2 ");
|
||||||
|
|
||||||
|
b.Property<string>("child2Id")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id หน่วยงาน child2 ");
|
||||||
|
|
||||||
|
b.Property<string>("child2ShortName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อย่อหน่วยงาน child2 ");
|
||||||
|
|
||||||
|
b.Property<string>("child3")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อหน่วยงาน child3 ");
|
||||||
|
|
||||||
|
b.Property<string>("child3Id")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id หน่วยงาน child3 ");
|
||||||
|
|
||||||
|
b.Property<string>("child3ShortName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อย่อหน่วยงาน child3 ");
|
||||||
|
|
||||||
|
b.Property<string>("child4")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อหน่วยงาน child4 ");
|
||||||
|
|
||||||
|
b.Property<string>("child4Id")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id หน่วยงาน child4 ");
|
||||||
|
|
||||||
|
b.Property<string>("child4ShortName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อย่อหน่วยงาน child4 ");
|
||||||
|
|
||||||
|
b.Property<string>("citizenId")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เลขบัตรประชาชน");
|
||||||
|
|
||||||
|
b.Property<string>("firstName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("lastName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("นามสกุล");
|
||||||
|
|
||||||
|
b.Property<string>("posExecutiveId")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id ตำแหน่งทางการบริหาร ");
|
||||||
|
|
||||||
|
b.Property<string>("posExecutiveName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อตำแหน่งทางการบริหาร ");
|
||||||
|
|
||||||
|
b.Property<string>("posLevelId")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id ระดับตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<string>("posLevelName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อระดับตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<int?>("posLevelRank")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ลำดับระดับตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<int?>("posMasterNo")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("เลขที่ตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<string>("posNo")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เลขที่ตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<string>("posTypeId")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id ประเภทตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<string>("posTypeName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อประเภทตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<int?>("posTypeRank")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ลำดับประเภทตำแหน่ง ");
|
||||||
|
|
||||||
|
b.Property<string>("position")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อตำแหน่งในสายงาน ");
|
||||||
|
|
||||||
|
b.Property<string>("prefix")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("คำนำหน้า");
|
||||||
|
|
||||||
|
b.Property<string>("profileId")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("profile Id");
|
||||||
|
|
||||||
|
b.Property<string>("root")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อหน่วยงาน root ");
|
||||||
|
|
||||||
|
b.Property<string>("rootId")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("id หน่วยงาน root ");
|
||||||
|
|
||||||
|
b.Property<string>("rootShortName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อย่อหน่วยงาน root ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RetirementPeriodId");
|
||||||
|
|
||||||
|
b.ToTable("RetirementRawProfiles");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResign", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResign", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -18906,6 +19101,17 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("RetirementResign");
|
b.Navigation("RetirementResign");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementRawProfile", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", "RetirementPeriod")
|
||||||
|
.WithMany("RetirementRawProfiles")
|
||||||
|
.HasForeignKey("RetirementPeriodId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("RetirementPeriod");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignCancel", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignCancel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementResign", "RetirementResign")
|
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementResign", "RetirementResign")
|
||||||
|
|
@ -19271,6 +19477,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("RetirementPeriodHistorys");
|
b.Navigation("RetirementPeriodHistorys");
|
||||||
|
|
||||||
b.Navigation("RetirementProfiles");
|
b.Navigation("RetirementProfiles");
|
||||||
|
|
||||||
|
b.Navigation("RetirementRawProfiles");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResign", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResign", b =>
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
public DbSet<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; }
|
public DbSet<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; }
|
||||||
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
||||||
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
||||||
|
public DbSet<RetirementRawProfile> RetirementRawProfiles { get; set; }
|
||||||
public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
|
public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
|
||||||
public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
|
public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
|
||||||
public DbSet<RetirementResign> RetirementResigns { get; set; }
|
public DbSet<RetirementResign> RetirementResigns { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ using Newtonsoft.Json.Linq;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace BMA.EHR.Retirement.Service.Controllers
|
namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -449,7 +450,51 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var dataRaw = new RetirementRawProfile
|
||||||
|
{
|
||||||
|
Order = order,
|
||||||
|
Remove = "PENDING",
|
||||||
|
RetirementPeriod = retire,
|
||||||
|
profileId = profile.profileId,
|
||||||
|
prefix = profile.prefix,
|
||||||
|
firstName = profile.firstName,
|
||||||
|
lastName = profile.lastName,
|
||||||
|
citizenId = profile.citizenId,
|
||||||
|
root = profile.root,
|
||||||
|
rootId = profile.rootId,
|
||||||
|
rootShortName = profile.rootShortName,
|
||||||
|
child1 = profile.child1,
|
||||||
|
child1Id = profile.child1Id,
|
||||||
|
child1ShortName = profile.child1ShortName,
|
||||||
|
child2 = profile.child2,
|
||||||
|
child2Id = profile.child2Id,
|
||||||
|
child2ShortName = profile.child2ShortName,
|
||||||
|
child3 = profile.child3,
|
||||||
|
child3Id = profile.child3Id,
|
||||||
|
child3ShortName = profile.child3ShortName,
|
||||||
|
child4 = profile.child4,
|
||||||
|
child4Id = profile.child4Id,
|
||||||
|
child4ShortName = profile.child4ShortName,
|
||||||
|
posMasterNo = profile.posMasterNo,
|
||||||
|
position = profile.position,
|
||||||
|
posTypeId = profile.posTypeId,
|
||||||
|
posTypeName = profile.posTypeName,
|
||||||
|
posTypeRank = profile.posTypeRank,
|
||||||
|
posLevelId = profile.posLevelId,
|
||||||
|
posLevelName = profile.posLevelName,
|
||||||
|
posLevelRank = profile.posLevelRank,
|
||||||
|
posExecutiveId = profile.posExecutiveId,
|
||||||
|
posExecutiveName = profile.posExecutiveName,
|
||||||
|
posNo = profile.posNo,
|
||||||
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
await _context.RetirementProfiles.AddAsync(data);
|
await _context.RetirementProfiles.AddAsync(data);
|
||||||
|
await _context.RetirementRawProfiles.AddAsync(dataRaw);
|
||||||
order++;
|
order++;
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
@ -920,6 +965,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
var num = 1;
|
var num = 1;
|
||||||
|
|
||||||
|
var profileRawCount = await _context.RetirementRawProfiles
|
||||||
|
.CountAsync(x => x.RetirementPeriod.Id == retireId);
|
||||||
|
|
||||||
// var old_retire = retire.RetirementProfiles.OrderByDescending(x => x.Order).FirstOrDefault();
|
// var old_retire = retire.RetirementProfiles.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||||
// if (old_retire != null)
|
// if (old_retire != null)
|
||||||
// num = old_retire.Order + 1;
|
// num = old_retire.Order + 1;
|
||||||
|
|
@ -941,7 +989,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var dataRaw = new RetirementRawProfile
|
||||||
|
{
|
||||||
|
Order = profileRawCount+1,
|
||||||
|
Remove = "ADD",
|
||||||
|
RetirementPeriod = retire,
|
||||||
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
|
|
@ -983,8 +1042,41 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
data.posExecutiveId = org.result.posExecutiveId;
|
data.posExecutiveId = org.result.posExecutiveId;
|
||||||
data.posExecutiveName = org.result.posExecutiveName;
|
data.posExecutiveName = org.result.posExecutiveName;
|
||||||
data.posNo = org.result.posNo;
|
data.posNo = org.result.posNo;
|
||||||
|
|
||||||
|
dataRaw.profileId = org.result.profileId;
|
||||||
|
dataRaw.prefix = org.result.prefix;
|
||||||
|
dataRaw.firstName = org.result.firstName;
|
||||||
|
dataRaw.lastName = org.result.lastName;
|
||||||
|
dataRaw.citizenId = org.result.citizenId;
|
||||||
|
dataRaw.root = org.result.root;
|
||||||
|
dataRaw.rootId = org.result.rootId;
|
||||||
|
dataRaw.rootShortName = org.result.rootShortName;
|
||||||
|
dataRaw.child1 = org.result.child1;
|
||||||
|
dataRaw.child1Id = org.result.child1Id;
|
||||||
|
dataRaw.child1ShortName = org.result.child1ShortName;
|
||||||
|
dataRaw.child2 = org.result.child2;
|
||||||
|
dataRaw.child2Id = org.result.child2Id;
|
||||||
|
dataRaw.child2ShortName = org.result.child2ShortName;
|
||||||
|
dataRaw.child3 = org.result.child3;
|
||||||
|
dataRaw.child3Id = org.result.child3Id;
|
||||||
|
dataRaw.child3ShortName = org.result.child3ShortName;
|
||||||
|
dataRaw.child4 = org.result.child4;
|
||||||
|
dataRaw.child4Id = org.result.child4Id;
|
||||||
|
dataRaw.child4ShortName = org.result.child4ShortName;
|
||||||
|
dataRaw.posMasterNo = org.result.posMasterNo;
|
||||||
|
dataRaw.position = org.result.position;
|
||||||
|
dataRaw.posTypeId = org.result.posTypeId;
|
||||||
|
dataRaw.posTypeName = org.result.posTypeName;
|
||||||
|
dataRaw.posTypeRank = org.result.posTypeRank;
|
||||||
|
dataRaw.posLevelId = org.result.posLevelId;
|
||||||
|
dataRaw.posLevelName = org.result.posLevelName;
|
||||||
|
dataRaw.posLevelRank = org.result.posLevelRank;
|
||||||
|
dataRaw.posExecutiveId = org.result.posExecutiveId;
|
||||||
|
dataRaw.posExecutiveName = org.result.posExecutiveName;
|
||||||
|
dataRaw.posNo = org.result.posNo;
|
||||||
|
|
||||||
_context.RetirementProfiles.Add(data);
|
_context.RetirementProfiles.Add(data);
|
||||||
|
_context.RetirementRawProfiles.Add(dataRaw);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
if (retire.RetirementPeriodHistorys.Count() == 0)
|
if (retire.RetirementPeriodHistorys.Count() == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1010,7 +1102,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var dataRaw = new RetirementRawProfile
|
||||||
|
{
|
||||||
|
Order = profileRawCount+1,
|
||||||
|
Remove = "ADD",
|
||||||
|
RetirementPeriod = retire,
|
||||||
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
|
|
@ -1053,7 +1156,38 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
//data.posExecutiveName = org.result.posExecutiveName;
|
//data.posExecutiveName = org.result.posExecutiveName;
|
||||||
data.posNo = org.result.posNo;
|
data.posNo = org.result.posNo;
|
||||||
|
|
||||||
|
dataRaw.profileId = org.result.profileId;
|
||||||
|
dataRaw.prefix = org.result.prefix;
|
||||||
|
dataRaw.firstName = org.result.firstName;
|
||||||
|
dataRaw.lastName = org.result.lastName;
|
||||||
|
dataRaw.citizenId = org.result.citizenId;
|
||||||
|
dataRaw.root = org.result.root;
|
||||||
|
dataRaw.rootId = org.result.rootId;
|
||||||
|
dataRaw.rootShortName = org.result.rootShortName;
|
||||||
|
dataRaw.child1 = org.result.child1;
|
||||||
|
dataRaw.child1Id = org.result.child1Id;
|
||||||
|
dataRaw.child1ShortName = org.result.child1ShortName;
|
||||||
|
dataRaw.child2 = org.result.child2;
|
||||||
|
dataRaw.child2Id = org.result.child2Id;
|
||||||
|
dataRaw.child2ShortName = org.result.child2ShortName;
|
||||||
|
dataRaw.child3 = org.result.child3;
|
||||||
|
dataRaw.child3Id = org.result.child3Id;
|
||||||
|
dataRaw.child3ShortName = org.result.child3ShortName;
|
||||||
|
dataRaw.child4 = org.result.child4;
|
||||||
|
dataRaw.child4Id = org.result.child4Id;
|
||||||
|
dataRaw.child4ShortName = org.result.child4ShortName;
|
||||||
|
dataRaw.posMasterNo = org.result.posMasterNo;
|
||||||
|
dataRaw.position = org.result.position;
|
||||||
|
dataRaw.posTypeId = org.result.posTypeId;
|
||||||
|
dataRaw.posTypeName = org.result.posTypeName;
|
||||||
|
dataRaw.posTypeRank = org.result.posTypeRank;
|
||||||
|
dataRaw.posLevelId = org.result.posLevelId;
|
||||||
|
dataRaw.posLevelName = org.result.posLevelName;
|
||||||
|
dataRaw.posLevelRank = org.result.posLevelRank;
|
||||||
|
dataRaw.posNo = org.result.posNo;
|
||||||
|
|
||||||
_context.RetirementProfiles.Add(data);
|
_context.RetirementProfiles.Add(data);
|
||||||
|
_context.RetirementRawProfiles.Add(dataRaw);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
if (retire.RetirementPeriodHistorys.Count() == 0)
|
if (retire.RetirementPeriodHistorys.Count() == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1088,11 +1222,22 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
var profileRaw = await _context.RetirementRawProfiles
|
||||||
|
.FirstOrDefaultAsync(x => x.profileId == profile.profileId);
|
||||||
|
if (profileRaw == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
profile.Remove = "EDIT";
|
profile.Remove = "EDIT";
|
||||||
profile.Reason = req.Reason;
|
profile.Reason = req.Reason;
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
|
||||||
|
profileRaw.Remove = "EDIT";
|
||||||
|
profileRaw.Reason = req.Reason;
|
||||||
|
profileRaw.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
profileRaw.LastUpdateUserId = UserId ?? "";
|
||||||
|
profileRaw.LastUpdatedAt = DateTime.Now;
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -1118,6 +1263,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
var profileRaw = await _context.RetirementRawProfiles
|
||||||
|
.FirstOrDefaultAsync(x => x.profileId == profile.profileId);
|
||||||
|
if (profileRaw == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
if (profile.RetirementPeriod.RetirementPeriodHistorys.Count() == 0)
|
if (profile.RetirementPeriod.RetirementPeriodHistorys.Count() == 0)
|
||||||
{
|
{
|
||||||
_context.RetirementProfiles.Remove(profile);
|
_context.RetirementProfiles.Remove(profile);
|
||||||
|
|
@ -1132,6 +1282,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
profile.LastUpdatedAt = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
profileRaw.Remove = "REMOVE";
|
||||||
|
profileRaw.Reason = req.Reason;
|
||||||
|
profileRaw.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
profileRaw.LastUpdateUserId = UserId ?? "";
|
||||||
|
profileRaw.LastUpdatedAt = DateTime.Now;
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -1843,5 +1998,45 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
};
|
};
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//เกษียณอายุราชการ
|
||||||
|
//public async Task ExecuteRetirement()
|
||||||
|
//{
|
||||||
|
// var retirePeriodOfficer = await _context.RetirementPeriods
|
||||||
|
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||||
|
// .Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
||||||
|
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||||
|
// .FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
// var body = retirePeriodOfficer.RetirementProfiles
|
||||||
|
// .Select(x => new
|
||||||
|
// {
|
||||||
|
// profileId = x.profileId,
|
||||||
|
// //lastUpdateUserId = UserId,
|
||||||
|
// //lastUpdateFullName = FullName,
|
||||||
|
// })
|
||||||
|
// .ToList();
|
||||||
|
|
||||||
|
// //ข้าราชการ
|
||||||
|
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||||
|
// var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
||||||
|
// using (var client = new HttpClient())
|
||||||
|
// {
|
||||||
|
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
// var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
|
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||||
|
// {
|
||||||
|
// Content = content
|
||||||
|
// };
|
||||||
|
// var response = await client.SendAsync(_req);
|
||||||
|
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
// if (!response.IsSuccessStatusCode)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ using System.Text;
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
using BMA.EHR.Retirement.Service.Filters;
|
using BMA.EHR.Retirement.Service.Filters;
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Retirement.Service.Controllers;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
{
|
{
|
||||||
|
|
@ -168,6 +169,8 @@ var app = builder.Build();
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
|
manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementRepository>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
||||||
|
//manager.AddOrUpdate("Test อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementController>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply migrations
|
// apply migrations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue