api list บรรจุ
api list คนในบรรจุ
This commit is contained in:
parent
385d37c985
commit
40e8a2641c
18 changed files with 31546 additions and 54 deletions
208
BMA.EHR.API.Command/MinIOService.cs
Normal file
208
BMA.EHR.API.Command/MinIOService.cs
Normal file
|
|
@ -0,0 +1,208 @@
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
|
namespace BMA.EHR.API.Command
|
||||||
|
{
|
||||||
|
public class MinIOService
|
||||||
|
{
|
||||||
|
// #region " Fields "
|
||||||
|
|
||||||
|
// private readonly ApplicationDBContext _context;
|
||||||
|
// private readonly IConfiguration _configuration;
|
||||||
|
// private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
|
// private readonly AmazonS3Client _s3Client;
|
||||||
|
// private string _bucketName = string.Empty;
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region " Constructors "
|
||||||
|
|
||||||
|
// public MinIOService(ApplicationDBContext context,
|
||||||
|
// IConfiguration configuration,
|
||||||
|
// IWebHostEnvironment webHostEnvironment)
|
||||||
|
// {
|
||||||
|
// _context = context;
|
||||||
|
// _configuration = configuration;
|
||||||
|
// _webHostEnvironment = webHostEnvironment;
|
||||||
|
|
||||||
|
// var config = new AmazonS3Config
|
||||||
|
// {
|
||||||
|
// ServiceURL = _configuration["MinIO:Endpoint"],
|
||||||
|
// ForcePathStyle = true
|
||||||
|
// };
|
||||||
|
|
||||||
|
// _s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||||
|
// this._bucketName = _configuration["MinIO:BucketName"] ?? "bma-recruit";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region " Methods "
|
||||||
|
|
||||||
|
// public async Task<Document> UploadFileAsync(IFormFile file, string newFileName = "")
|
||||||
|
// {
|
||||||
|
// var fileName = "";
|
||||||
|
// var fileExt = Path.GetExtension(file.FileName);
|
||||||
|
// if (newFileName != "")
|
||||||
|
// fileName = $"{newFileName}";
|
||||||
|
// else
|
||||||
|
// fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
|
||||||
|
|
||||||
|
|
||||||
|
// var tmpDir = Path.Combine(_webHostEnvironment.ContentRootPath, "tmp");
|
||||||
|
// if (!Directory.Exists(tmpDir))
|
||||||
|
// Directory.CreateDirectory(tmpDir);
|
||||||
|
|
||||||
|
// var tmpFile = Path.Combine(tmpDir, $"tmp_{DateTime.Now.ToString("ddMMyyyyHHmmss")}{fileExt}");
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// using (var ms = new MemoryStream())
|
||||||
|
// {
|
||||||
|
// var id = Guid.NewGuid();
|
||||||
|
// file.CopyTo(ms);
|
||||||
|
// var fileBytes = ms.ToArray();
|
||||||
|
// System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileBytes);
|
||||||
|
|
||||||
|
// var request = new PutObjectRequest
|
||||||
|
// {
|
||||||
|
// BucketName = _bucketName,
|
||||||
|
// Key = id.ToString("D"),
|
||||||
|
// InputStream = filestream,
|
||||||
|
// ContentType = file.ContentType,
|
||||||
|
// CannedACL = S3CannedACL.PublicRead
|
||||||
|
// };
|
||||||
|
|
||||||
|
// await _s3Client.PutObjectAsync(request);
|
||||||
|
|
||||||
|
// // create document object
|
||||||
|
// var doc = new Document()
|
||||||
|
// {
|
||||||
|
// FileName = fileName,
|
||||||
|
// FileType = file.ContentType,
|
||||||
|
// FileSize = Convert.ToInt32(file.Length),
|
||||||
|
// ObjectRefId = id,
|
||||||
|
// CreatedDate = DateTime.Now
|
||||||
|
// };
|
||||||
|
|
||||||
|
// await _context.Documents.AddAsync(doc);
|
||||||
|
// await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
// return doc;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch
|
||||||
|
// {
|
||||||
|
// throw;
|
||||||
|
// }
|
||||||
|
// finally
|
||||||
|
// {
|
||||||
|
// File.Delete(tmpFile);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public async Task<FileDownloadResponse> DownloadFileAsync(Guid fileId)
|
||||||
|
// {
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// var doc = await _context.Documents.AsQueryable()
|
||||||
|
// .FirstOrDefaultAsync(x => x.Id == fileId);
|
||||||
|
|
||||||
|
// if (doc == null)
|
||||||
|
// throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||||
|
|
||||||
|
// using (var memoryStream = new MemoryStream())
|
||||||
|
// {
|
||||||
|
// GetObjectRequest request = new GetObjectRequest
|
||||||
|
// {
|
||||||
|
// BucketName = _bucketName,
|
||||||
|
// Key = doc.ObjectRefId.ToString("D")
|
||||||
|
// };
|
||||||
|
|
||||||
|
// using (GetObjectResponse response = await _s3Client.GetObjectAsync(request))
|
||||||
|
// {
|
||||||
|
// using (Stream responseStream = response.ResponseStream)
|
||||||
|
// {
|
||||||
|
// responseStream.CopyTo(memoryStream);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var fileContent = memoryStream.ToArray();
|
||||||
|
|
||||||
|
// return new FileDownloadResponse
|
||||||
|
// {
|
||||||
|
// FileName = doc.FileName,
|
||||||
|
// FileType = doc.FileType,
|
||||||
|
// FileContent = fileContent
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// catch
|
||||||
|
// {
|
||||||
|
// throw;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public async Task DeleteFileAsync(Guid fileId)
|
||||||
|
// {
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// var doc = await _context.Documents.AsQueryable()
|
||||||
|
// .FirstOrDefaultAsync(x => x.Id == fileId);
|
||||||
|
|
||||||
|
// if (doc == null)
|
||||||
|
// throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// DeleteObjectRequest request = new DeleteObjectRequest
|
||||||
|
// {
|
||||||
|
// BucketName = _bucketName,
|
||||||
|
// Key = doc?.ObjectRefId.ToString("D")
|
||||||
|
// };
|
||||||
|
|
||||||
|
// // delete from minio
|
||||||
|
// await _s3Client.DeleteObjectAsync(request);
|
||||||
|
|
||||||
|
|
||||||
|
// _context.Documents.Remove(doc);
|
||||||
|
// await _context.SaveChangesAsync();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch
|
||||||
|
// {
|
||||||
|
// throw;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public async Task<string> ImagesPath(Guid fileId)
|
||||||
|
// {
|
||||||
|
// if (fileId == null)
|
||||||
|
// return "";
|
||||||
|
|
||||||
|
// var doc = await _context.Documents.AsQueryable()
|
||||||
|
// .FirstOrDefaultAsync(x => x.Id == fileId);
|
||||||
|
|
||||||
|
// if (doc == null)
|
||||||
|
// throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||||
|
// var config = new AmazonS3Config
|
||||||
|
// {
|
||||||
|
// ServiceURL = _configuration.GetValue<string>("MinIO:Endpoint"),
|
||||||
|
// ForcePathStyle = true
|
||||||
|
// };
|
||||||
|
|
||||||
|
// DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||||
|
// GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||||
|
// {
|
||||||
|
// BucketName = _bucketName,
|
||||||
|
// Key = doc?.ObjectRefId.ToString("D"),
|
||||||
|
// Expires = expires,
|
||||||
|
// };
|
||||||
|
// string path = _s3Client.GetPreSignedURL(request);
|
||||||
|
|
||||||
|
// return path;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ namespace BMA.EHR.Application
|
||||||
public static IServiceCollection AddApplication(this IServiceCollection services)
|
public static IServiceCollection AddApplication(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddTransient<PrefixRepository>();
|
services.AddTransient<PrefixRepository>();
|
||||||
|
services.AddTransient<PlacementRepository>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
[Required, Comment("จำนวนผู้สอบได้"), MaxLength(10)]
|
[Required, Comment("จำนวนผู้สอบได้"), MaxLength(10)]
|
||||||
public int Number { get; set; } = 0;
|
public int Number { get; set; } = 0;
|
||||||
[Required, Comment("ประเภทการสอบ")]
|
[Required, Comment("ประเภทการสอบ")]
|
||||||
public string TypeExam { get; set; } = string.Empty;
|
public required PlacementType PlacementType { get; set; }
|
||||||
[Required, Comment("วันที่เริ่มบัญชีบัญชี")]
|
[Required, Comment("วันที่เริ่มบัญชีบัญชี")]
|
||||||
public DateTime StartDate { get; set; }
|
public DateTime StartDate { get; set; }
|
||||||
[Required, Comment("วันที่สิ้นสุดบัญชี")]
|
[Required, Comment("วันที่สิ้นสุดบัญชี")]
|
||||||
|
|
@ -23,5 +23,6 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
|
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
|
public virtual List<PlacementProfile> PlacementProfiles { get; set; } = new List<PlacementProfile>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,16 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public string? Firstname { get; set; }
|
public string? Firstname { get; set; }
|
||||||
[Comment("นามสกุล")]
|
[Comment("นามสกุล")]
|
||||||
public string? Lastname { get; set; }
|
public string? Lastname { get; set; }
|
||||||
|
[Comment("Id เพศ")]
|
||||||
|
public Gender? Gender { get; set; }
|
||||||
[Comment("ลำดับที่สอบได้")]
|
[Comment("ลำดับที่สอบได้")]
|
||||||
public int? Number { get; set; }
|
public int? Number { get; set; }
|
||||||
[Comment("Id เลขที่ตำแหน่ง")]
|
[Comment("Id เลขที่ตำแหน่ง")]
|
||||||
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||||
[Comment("วันที่บรรจุ")]
|
[Comment("วันที่บรรจุ")]
|
||||||
public DateTime? RecruitDate { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
|
[Comment("วันที่รายงานตัว")]
|
||||||
|
public DateTime? ReportingDate { get; set; }
|
||||||
[Comment("เงินเดือน")]
|
[Comment("เงินเดือน")]
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
[Comment("เงินประจำตำแหน่ง")]
|
[Comment("เงินประจำตำแหน่ง")]
|
||||||
|
|
@ -37,9 +41,11 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
[Comment("ข้าราชการฯ กทม.")]
|
[Comment("ข้าราชการฯ กทม.")]
|
||||||
public bool? IsOfficer { get; set; }
|
public bool? IsOfficer { get; set; }
|
||||||
[Comment("สถานะการบรรจุ")]
|
[Comment("สถานะการบรรจุ")]
|
||||||
public PlacementStatus? PlacementStatus { get; set; }
|
public string PlacementStatus { get; set; } = "un-contain";
|
||||||
[Comment("เหตุผลสละสิทธิ์")]
|
[Comment("เหตุผลสละสิทธิ์")]
|
||||||
public string? RejectReason { get; set; }
|
public string? RejectReason { get; set; }
|
||||||
|
[Comment("ผ่อนผัน")]
|
||||||
|
public bool IsRelief { get; set; } = false;
|
||||||
[Comment("เหตุผลผ่อนผัน")]
|
[Comment("เหตุผลผ่อนผัน")]
|
||||||
public string? ReliefReason { get; set; }
|
public string? ReliefReason { get; set; }
|
||||||
[Comment("Id เอกสารผ่อนผัน")]
|
[Comment("Id เอกสารผ่อนผัน")]
|
||||||
|
|
@ -224,5 +230,7 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
|
|
||||||
[Comment("ผลสมัครสอบ")]
|
[Comment("ผลสมัครสอบ")]
|
||||||
public string? Pass { get; set; }
|
public string? Pass { get; set; }
|
||||||
|
public virtual List<PlacementCareer> PlacementCareers { get; set; } = new List<PlacementCareer>();
|
||||||
|
public virtual List<PlacementEducation> PlacementEducations { get; set; } = new List<PlacementEducation>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ using BMA.EHR.Domain.Models.Base;
|
||||||
|
|
||||||
namespace BMA.EHR.Domain.Models.Placement
|
namespace BMA.EHR.Domain.Models.Placement
|
||||||
{
|
{
|
||||||
public class PlacementStatus : EntityBase
|
public class PlacementType : EntityBase
|
||||||
{
|
{
|
||||||
[Required, Comment("ชื่อสถานะบรรจุ")]
|
[Required, Comment("ชื่อประเภทบรรจุ")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
10249
BMA.EHR.Infrastructure/Migrations/20230629083241_Update table Placement add PlacementType.Designer.cs
generated
Normal file
10249
BMA.EHR.Infrastructure/Migrations/20230629083241_Update table Placement add PlacementType.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,92 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class UpdatetablePlacementaddPlacementType : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "TypeExam",
|
||||||
|
table: "Placements");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PlacementTypeId",
|
||||||
|
table: "Placements",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PlacementTypes",
|
||||||
|
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"),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อประเภทบรรจุ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PlacementTypes", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Placements_PlacementTypeId",
|
||||||
|
table: "Placements",
|
||||||
|
column: "PlacementTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Placements_PlacementTypes_PlacementTypeId",
|
||||||
|
table: "Placements",
|
||||||
|
column: "PlacementTypeId",
|
||||||
|
principalTable: "PlacementTypes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Placements_PlacementTypes_PlacementTypeId",
|
||||||
|
table: "Placements");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PlacementTypes");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Placements_PlacementTypeId",
|
||||||
|
table: "Placements");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PlacementTypeId",
|
||||||
|
table: "Placements");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "TypeExam",
|
||||||
|
table: "Placements",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "ประเภทการสอบ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10212
BMA.EHR.Infrastructure/Migrations/20230629112400_Update table Placement add ReportingDate.Designer.cs
generated
Normal file
10212
BMA.EHR.Infrastructure/Migrations/20230629112400_Update table Placement add ReportingDate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,124 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class UpdatetablePlacementaddReportingDate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementProfiles_PlacementStatuses_PlacementStatusId",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PlacementStatuses");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "PlacementStatusId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
newName: "GenderId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_PlacementProfiles_PlacementStatusId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
newName: "IX_PlacementProfiles_GenderId");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsRelief",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false,
|
||||||
|
comment: "ผ่อนผัน");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "PlacementStatus",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "สถานะการบรรจุ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "ReportingDate",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "วันที่รายงานตัว");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementProfiles_Genders_GenderId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
column: "GenderId",
|
||||||
|
principalTable: "Genders",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementProfiles_Genders_GenderId",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsRelief",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PlacementStatus",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ReportingDate",
|
||||||
|
table: "PlacementProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "GenderId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
newName: "PlacementStatusId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_PlacementProfiles_GenderId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
newName: "IX_PlacementProfiles_PlacementStatusId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PlacementStatuses",
|
||||||
|
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"),
|
||||||
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อสถานะบรรจุ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PlacementStatuses", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementProfiles_PlacementStatuses_PlacementStatusId",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
column: "PlacementStatusId",
|
||||||
|
principalTable: "PlacementStatuses",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10213
BMA.EHR.Infrastructure/Migrations/20230629131642_Update table Placement add start status.Designer.cs
generated
Normal file
10213
BMA.EHR.Infrastructure/Migrations/20230629131642_Update table Placement add start status.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class UpdatetablePlacementaddstartstatus : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
keyColumn: "PlacementStatus",
|
||||||
|
keyValue: null,
|
||||||
|
column: "PlacementStatus",
|
||||||
|
value: "");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PlacementStatus",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการบรรจุ",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "สถานะการบรรจุ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "PlacementStatus",
|
||||||
|
table: "PlacementProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "สถานะการบรรจุ",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldComment: "สถานะการบรรจุ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8524,6 +8524,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("int")
|
.HasColumnType("int")
|
||||||
.HasComment("จำนวนผู้สอบได้");
|
.HasComment("จำนวนผู้สอบได้");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlacementTypeId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<string>("Round")
|
b.Property<string>("Round")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
|
|
@ -8533,11 +8536,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("datetime(6)")
|
.HasColumnType("datetime(6)")
|
||||||
.HasComment("วันที่เริ่มบัญชีบัญชี");
|
.HasComment("วันที่เริ่มบัญชีบัญชี");
|
||||||
|
|
||||||
b.Property<string>("TypeExam")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext")
|
|
||||||
.HasComment("ประเภทการสอบ");
|
|
||||||
|
|
||||||
b.Property<int>("Year")
|
b.Property<int>("Year")
|
||||||
.HasMaxLength(5)
|
.HasMaxLength(5)
|
||||||
.HasColumnType("int")
|
.HasColumnType("int")
|
||||||
|
|
@ -8545,6 +8543,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlacementTypeId");
|
||||||
|
|
||||||
b.ToTable("Placements");
|
b.ToTable("Placements");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -8889,6 +8889,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ชื่อ");
|
.HasComment("ชื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid?>("GenderId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<bool?>("IsOfficer")
|
b.Property<bool?>("IsOfficer")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasComment("ข้าราชการฯ กทม.");
|
.HasComment("ข้าราชการฯ กทม.");
|
||||||
|
|
@ -8897,6 +8900,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("การคัดกรองคุณสมบัติ");
|
.HasComment("การคัดกรองคุณสมบัติ");
|
||||||
|
|
||||||
|
b.Property<bool>("IsRelief")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("ผ่อนผัน");
|
||||||
|
|
||||||
b.Property<string>("Knowledge")
|
b.Property<string>("Knowledge")
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ความสามารถพิเศษ");
|
.HasComment("ความสามารถพิเศษ");
|
||||||
|
|
@ -9028,8 +9035,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<Guid?>("PlacementId")
|
b.Property<Guid?>("PlacementId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<Guid?>("PlacementStatusId")
|
b.Property<string>("PlacementStatus")
|
||||||
.HasColumnType("char(36)");
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะการบรรจุ");
|
||||||
|
|
||||||
b.Property<double?>("PointA")
|
b.Property<double?>("PointA")
|
||||||
.HasColumnType("double")
|
.HasColumnType("double")
|
||||||
|
|
@ -9120,6 +9129,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("เหตุผลผ่อนผัน");
|
.HasComment("เหตุผลผ่อนผัน");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("ReportingDate")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("วันที่รายงานตัว");
|
||||||
|
|
||||||
b.Property<string>("SalaryClass")
|
b.Property<string>("SalaryClass")
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ตำแหน่ง (รายละเอียด)");
|
.HasComment("ตำแหน่ง (รายละเอียด)");
|
||||||
|
|
@ -9147,6 +9160,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.HasIndex("FatherPrefixId");
|
b.HasIndex("FatherPrefixId");
|
||||||
|
|
||||||
|
b.HasIndex("GenderId");
|
||||||
|
|
||||||
b.HasIndex("MarryPrefixId");
|
b.HasIndex("MarryPrefixId");
|
||||||
|
|
||||||
b.HasIndex("MotherPrefixId");
|
b.HasIndex("MotherPrefixId");
|
||||||
|
|
@ -9155,8 +9170,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.HasIndex("PlacementId");
|
b.HasIndex("PlacementId");
|
||||||
|
|
||||||
b.HasIndex("PlacementStatusId");
|
|
||||||
|
|
||||||
b.HasIndex("PositionLevelId");
|
b.HasIndex("PositionLevelId");
|
||||||
|
|
||||||
b.HasIndex("PositionLineId");
|
b.HasIndex("PositionLineId");
|
||||||
|
|
@ -9184,7 +9197,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.ToTable("PlacementProfiles");
|
b.ToTable("PlacementProfiles");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementStatus", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementType", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
|
@ -9238,11 +9251,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ชื่อสถานะบรรจุ");
|
.HasComment("ชื่อประเภทบรรจุ");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("PlacementStatuses");
|
b.ToTable("PlacementTypes");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
|
||||||
|
|
@ -9833,10 +9846,21 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("Report2DetailHistory");
|
b.Navigation("Report2DetailHistory");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementType", "PlacementType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PlacementTypeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("PlacementType");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCareer", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCareer", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
|
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
|
||||||
.WithMany()
|
.WithMany("PlacementCareers")
|
||||||
.HasForeignKey("PlacementProfileId")
|
.HasForeignKey("PlacementProfileId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
@ -9851,7 +9875,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasForeignKey("EducationLevelId");
|
.HasForeignKey("EducationLevelId");
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
|
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
|
||||||
.WithMany()
|
.WithMany("PlacementEducations")
|
||||||
.HasForeignKey("PlacementProfileId")
|
.HasForeignKey("PlacementProfileId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
@ -9887,6 +9911,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("FatherPrefixId");
|
.HasForeignKey("FatherPrefixId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GenderId");
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MarryPrefix")
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MarryPrefix")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("MarryPrefixId");
|
.HasForeignKey("MarryPrefixId");
|
||||||
|
|
@ -9900,13 +9928,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasForeignKey("OrganizationPositionId");
|
.HasForeignKey("OrganizationPositionId");
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
|
b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
|
||||||
.WithMany()
|
.WithMany("PlacementProfiles")
|
||||||
.HasForeignKey("PlacementId");
|
.HasForeignKey("PlacementId");
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementStatus", "PlacementStatus")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("PlacementStatusId");
|
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("PositionLevelId");
|
.HasForeignKey("PositionLevelId");
|
||||||
|
|
@ -9967,6 +9991,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Navigation("FatherPrefix");
|
b.Navigation("FatherPrefix");
|
||||||
|
|
||||||
|
b.Navigation("Gender");
|
||||||
|
|
||||||
b.Navigation("MarryPrefix");
|
b.Navigation("MarryPrefix");
|
||||||
|
|
||||||
b.Navigation("MotherPrefix");
|
b.Navigation("MotherPrefix");
|
||||||
|
|
@ -9975,8 +10001,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Navigation("Placement");
|
b.Navigation("Placement");
|
||||||
|
|
||||||
b.Navigation("PlacementStatus");
|
|
||||||
|
|
||||||
b.Navigation("PositionLevel");
|
b.Navigation("PositionLevel");
|
||||||
|
|
||||||
b.Navigation("PositionLine");
|
b.Navigation("PositionLine");
|
||||||
|
|
@ -10168,6 +10192,18 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
{
|
{
|
||||||
b.Navigation("PositionMasterHistorys");
|
b.Navigation("PositionMasterHistorys");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlacementProfiles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlacementCareers");
|
||||||
|
|
||||||
|
b.Navigation("PlacementEducations");
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
public DbSet<PlacementEducation> PlacementEducations { get; set; }
|
public DbSet<PlacementEducation> PlacementEducations { get; set; }
|
||||||
public DbSet<PlacementIsProperty> PlacementIsProperties { get; set; }
|
public DbSet<PlacementIsProperty> PlacementIsProperties { get; set; }
|
||||||
public DbSet<PlacementProfile> PlacementProfiles { get; set; }
|
public DbSet<PlacementProfile> PlacementProfiles { get; set; }
|
||||||
public DbSet<PlacementStatus> PlacementStatuses { get; set; }
|
public DbSet<PlacementType> PlacementTypes { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,50 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
using BMA.EHR.Placement.Service.Requests;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Sentry;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]/placement")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Authorize]
|
||||||
|
[SwaggerTag("ระบบบรรจุ")]
|
||||||
public class PlacementController : BaseController
|
public class PlacementController : BaseController
|
||||||
{
|
{
|
||||||
private readonly PlacementRepository _repository;
|
private readonly PlacementRepository _repository;
|
||||||
|
private readonly ApplicationDBContext _context;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public PlacementController(PlacementRepository repository)
|
public PlacementController(PlacementRepository repository,
|
||||||
|
ApplicationDBContext context,
|
||||||
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_context = context;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
|
||||||
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<ResponseObject>> Get()
|
public async Task<ActionResult<ResponseObject>> Get()
|
||||||
{
|
{
|
||||||
|
|
@ -23,5 +52,234 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("fiscal")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetFiscal()
|
||||||
|
{
|
||||||
|
var data = await _repository.GetAllAsync();
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
var _data = data.GroupBy(x => x.Year).Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.FirstOrDefault().Year,
|
||||||
|
Name = x.FirstOrDefault().Year + 543,
|
||||||
|
}).ToList();
|
||||||
|
return Success(_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("exam/{year}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetExam(int year)
|
||||||
|
{
|
||||||
|
var data = await _context.Placements.Where(x => x.Year == year).Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ExamRound = x.Name,
|
||||||
|
ExamOrder = x.Round,
|
||||||
|
FiscalYear = x.Year + 543,
|
||||||
|
NumberOfCandidates = x.PlacementProfiles.Count(),
|
||||||
|
ExamTypeValue = x.PlacementType.Id,
|
||||||
|
ExamTypeName = x.PlacementType.Name,
|
||||||
|
AccountStartDate = x.StartDate,
|
||||||
|
AccountEndDate = x.EndDate,
|
||||||
|
AccountExpirationDate = x.EndDate,
|
||||||
|
IsExpired = x.EndDate.Date < DateTime.Now.Date,
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("pass/{examId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetExamByPlacement(Guid examId)
|
||||||
|
{
|
||||||
|
var data = await _context.PlacementProfiles.Where(x => x.Placement.Id == examId).Select(x => new
|
||||||
|
{
|
||||||
|
PersonalId = x.Id,
|
||||||
|
FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
|
||||||
|
IdCard = x.CitizenId,
|
||||||
|
ProfilePhoto = x.Id,
|
||||||
|
OrganizationName = x.OrganizationPosition == null ? null : x.OrganizationPosition.OrganizationId,////
|
||||||
|
OrganizationShortName = x.OrganizationPosition == null ? null : x.OrganizationPosition.OrganizationId,////
|
||||||
|
PositionNumber = x.PositionNumber == null ? null : x.PositionNumber.Name,
|
||||||
|
PositionPath = x.PositionPath == null ? null : x.PositionPath.Name,
|
||||||
|
ReportingDate = x.ReportingDate,
|
||||||
|
BmaOfficer = x.IsOfficer,
|
||||||
|
StatusId = x.PlacementStatus,
|
||||||
|
Disclaim = x.IsRelief,
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("personal/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetProfileByUser(Guid personalId)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
if (person.IsProperty == null || Newtonsoft.Json.JsonConvert.DeserializeObject<List<PersonPropertyRequest>>(person.IsProperty).Count() == 0)
|
||||||
|
{
|
||||||
|
var isProperty = await _context.PlacementIsProperties.Select(x => new PersonPropertyRequest
|
||||||
|
{
|
||||||
|
Name = x.Name,
|
||||||
|
Value = false,
|
||||||
|
}).ToListAsync();
|
||||||
|
person.IsProperty = Newtonsoft.Json.JsonConvert.SerializeObject(isProperty);
|
||||||
|
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
person.LastUpdateUserId = UserId ?? "";
|
||||||
|
person.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _context.PlacementProfiles.Select(x => new
|
||||||
|
{
|
||||||
|
PersonalId = x.Id,
|
||||||
|
IdCard = x.CitizenId,
|
||||||
|
FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
|
||||||
|
DateOfBirth = x.DateOfBirth,
|
||||||
|
Gender = x.Gender == null ? null : x.Gender.Name,
|
||||||
|
Address = $"{x.RegistAddress}" +
|
||||||
|
(x.RegistSubDistrict == null ? null : " แขวง") + (x.RegistSubDistrict == null ? null : x.RegistSubDistrict.Name) +
|
||||||
|
(x.RegistDistrict == null ? null : " เขต") + (x.RegistDistrict == null ? null : x.RegistDistrict.Name) +
|
||||||
|
(x.RegistProvince == null ? null : " จังหวัด") + (x.RegistProvince == null ? null : x.RegistProvince.Name) +
|
||||||
|
(x.RegistSubDistrict == null ? null : " ") + (x.RegistSubDistrict == null ? null : x.RegistSubDistrict.ZipCode),
|
||||||
|
Education = x.PlacementEducations.Select(p => new
|
||||||
|
{
|
||||||
|
EducationLevel = p.EducationLevel == null ? null : p.EducationLevel.Name,
|
||||||
|
Major = p.Major,
|
||||||
|
Scores = p.Scores,
|
||||||
|
Name = p.Name,
|
||||||
|
DurationStart = p.DurationStart,
|
||||||
|
DurationEnd = p.DurationEnd,
|
||||||
|
}),
|
||||||
|
PointA = x.PointA,
|
||||||
|
PointB = x.PointB,
|
||||||
|
PointC = x.PointC,
|
||||||
|
PointTotalA = x.PointTotalA,
|
||||||
|
PointTotalB = x.PointTotalB,
|
||||||
|
PointTotalC = x.PointTotalC,
|
||||||
|
Point = x.PointA + x.PointB + x.PointC,
|
||||||
|
PointTotal = x.PointTotalA + x.PointTotalB + x.PointTotalC,
|
||||||
|
ExamNumber = x.ExamNumber,
|
||||||
|
ExamRound = x.ExamRound,
|
||||||
|
Pass = x.Pass,
|
||||||
|
IsProperty = x.IsProperty == null ? null : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PersonPropertyRequest>>(x.IsProperty),
|
||||||
|
}).FirstOrDefaultAsync(x => x.PersonalId == personalId);
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("property/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdatePropertyByUser([FromBody] List<PersonPropertyRequest> req, Guid personalId)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
person.IsProperty = Newtonsoft.Json.JsonConvert.SerializeObject(req);
|
||||||
|
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
person.LastUpdateUserId = UserId ?? "";
|
||||||
|
person.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("pass/stat/{examId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetDashboardByPlacement(Guid examId)
|
||||||
|
{
|
||||||
|
var placement = await _context.Placements
|
||||||
|
.Where(x => x.Id == examId)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Total = x.PlacementProfiles.Count(),
|
||||||
|
UnContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
|
||||||
|
PrepareContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
|
||||||
|
Contain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
|
||||||
|
Disclaim = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
if (placement == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
return Success(placement);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("pass/deferment")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdatePersonDeferment([FromBody] PersonDefermentRequest req)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(req.PersonalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
person.IsRelief = true;
|
||||||
|
person.ReliefReason = req.Note;
|
||||||
|
person.PlacementStatus = "UN-CONTAIN";
|
||||||
|
//person.ReliefDoc = req.UploadFile;xxxxxxxxxxxxxx
|
||||||
|
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
person.LastUpdateUserId = UserId ?? "";
|
||||||
|
person.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("pass/disclaim")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdatePersonDisclaim([FromBody] PersonDisclaimRequest req)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(req.PersonalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
person.RejectReason = req.Note;
|
||||||
|
person.PlacementStatus = "DISCLAIM";
|
||||||
|
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
person.LastUpdateUserId = UserId ?? "";
|
||||||
|
person.LastUpdatedAt = DateTime.Now;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("pass/deferment/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetPersonDeferment(Guid personalId)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
var data = new
|
||||||
|
{
|
||||||
|
ReliefReason = person.ReliefReason,
|
||||||
|
ReliefDoc = person.ReliefReason,
|
||||||
|
//ReliefDoc = person.ReliefDoc == null ? null : await _documentService.ImagesPath(person.ReliefDoc.Id),xxxxxxxxxxxxxx
|
||||||
|
};
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("pass/disclaim/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetPersonDisclaim(Guid personalId)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
var data = new
|
||||||
|
{
|
||||||
|
RejectReason = person.RejectReason,
|
||||||
|
};
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("pass/stat/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdatePositionByPerson(Guid personalId)
|
||||||
|
{
|
||||||
|
var person = await _context.PlacementProfiles.FindAsync(personalId);
|
||||||
|
if (person == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
BMA.EHR.Placement.Service/Requests/PersonDefermentRequest.cs
Normal file
11
BMA.EHR.Placement.Service/Requests/PersonDefermentRequest.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Placement.Service.Requests
|
||||||
|
{
|
||||||
|
public class PersonDisclaimRequest
|
||||||
|
{
|
||||||
|
public Guid PersonalId { get; set; }
|
||||||
|
public string Note { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
BMA.EHR.Placement.Service/Requests/PersonDisclaimRequest.cs
Normal file
12
BMA.EHR.Placement.Service/Requests/PersonDisclaimRequest.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Placement.Service.Requests
|
||||||
|
{
|
||||||
|
public class PersonDefermentRequest
|
||||||
|
{
|
||||||
|
public Guid PersonalId { get; set; }
|
||||||
|
public string Note { get; set; }
|
||||||
|
public bool UploadFile { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
BMA.EHR.Placement.Service/Requests/PersonPropertyRequest.cs
Normal file
11
BMA.EHR.Placement.Service/Requests/PersonPropertyRequest.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Placement.Service.Requests
|
||||||
|
{
|
||||||
|
public class PersonPropertyRequest
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool Value { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,28 +1,34 @@
|
||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Warning"
|
"System": "Warning"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
"ElasticConfiguration": {
|
|
||||||
"Uri": "http://localhost:9200"
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"ConnectionStrings": {
|
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
|
||||||
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
|
||||||
},
|
|
||||||
"Jwt": {
|
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
|
||||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
|
||||||
},
|
|
||||||
"EPPlus": {
|
|
||||||
"ExcelPackage": {
|
|
||||||
"LicenseContext": "NonCommercial"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"ElasticConfiguration": {
|
||||||
|
"Uri": "http://localhost:9200"
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
|
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
|
},
|
||||||
|
"Jwt": {
|
||||||
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
|
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||||
|
},
|
||||||
|
"EPPlus": {
|
||||||
|
"ExcelPackage": {
|
||||||
|
"LicenseContext": "NonCommercial"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MinIO": {
|
||||||
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
|
"AccessKey": "frappet",
|
||||||
|
"SecretKey": "P@ssw0rd",
|
||||||
|
"BucketName": "bma-recruit"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue