migrate retirehistory
This commit is contained in:
parent
0bf0386863
commit
df9c2204d8
12 changed files with 12507 additions and 38 deletions
|
|
@ -76,6 +76,7 @@
|
||||||
|
|
||||||
#region " Retirement "
|
#region " Retirement "
|
||||||
public static readonly string InvalidRetirementRequest = "ไม่พบข้อมูลการประกาศเกษียณอายุราชการ";
|
public static readonly string InvalidRetirementRequest = "ไม่พบข้อมูลการประกาศเกษียณอายุราชการ";
|
||||||
|
public static readonly string InvalidRetirementHistoryRequest = "ไม่พบข้อมูลประวัติการประกาศเกษียณอายุราชการ";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " Command "
|
#region " Command "
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="MimeTypeMapOfficial" Version="1.0.17" />
|
||||||
<PackageReference Include="Oracle.EntityFrameworkCore" Version="7.21.9" />
|
<PackageReference Include="Oracle.EntityFrameworkCore" Version="7.21.9" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
|
||||||
|
|
|
||||||
12164
BMA.EHR.Infrastructure/Migrations/20230803041956_add Table retire_history.Designer.cs
generated
Normal file
12164
BMA.EHR.Infrastructure/Migrations/20230803041956_add Table retire_history.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,77 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addTableretire_history : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "TypeReport",
|
||||||
|
table: "RetirementPeriods",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ประเภทคำสั่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RetirementPeriodHistorys",
|
||||||
|
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"),
|
||||||
|
Round = table.Column<int>(type: "int", nullable: false, comment: "ครั้งที่"),
|
||||||
|
TypeReport = table.Column<string>(type: "longtext", nullable: true, comment: "ประเภทคำสั่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Year = table.Column<int>(type: "int", nullable: false, comment: "ปีงบประมาณ"),
|
||||||
|
Total = table.Column<int>(type: "int", nullable: false, comment: "จำนวนคน"),
|
||||||
|
Type = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภท")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ProfileFile = 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")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RetirementPeriodHistorys", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RetirementPeriodHistorys_RetirementPeriods_RetirementPeriodId",
|
||||||
|
column: x => x.RetirementPeriodId,
|
||||||
|
principalTable: "RetirementPeriods",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RetirementPeriodHistorys_RetirementPeriodId",
|
||||||
|
table: "RetirementPeriodHistorys",
|
||||||
|
column: "RetirementPeriodId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RetirementPeriodHistorys");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "TypeReport",
|
||||||
|
table: "RetirementPeriods");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10559,6 +10559,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ประเภท");
|
.HasComment("ประเภท");
|
||||||
|
|
||||||
|
b.Property<string>("TypeReport")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภทคำสั่ง");
|
||||||
|
|
||||||
b.Property<int>("Year")
|
b.Property<int>("Year")
|
||||||
.HasColumnType("int")
|
.HasColumnType("int")
|
||||||
.HasComment("ปีงบประมาณ");
|
.HasComment("ปีงบประมาณ");
|
||||||
|
|
@ -10568,6 +10572,89 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.ToTable("RetirementPeriods");
|
b.ToTable("RetirementPeriods");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriodHistory", 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<string>("ProfileFile")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("รายชื่อเกษียญ");
|
||||||
|
|
||||||
|
b.Property<Guid>("RetirementPeriodId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<int>("Round")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ครั้งที่");
|
||||||
|
|
||||||
|
b.Property<int>("Total")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("จำนวนคน");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภท");
|
||||||
|
|
||||||
|
b.Property<string>("TypeReport")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภทคำสั่ง");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ปีงบประมาณ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RetirementPeriodId");
|
||||||
|
|
||||||
|
b.ToTable("RetirementPeriodHistorys");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementProfile", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementProfile", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -11827,6 +11914,17 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("Religion");
|
b.Navigation("Religion");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriodHistory", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", "RetirementPeriod")
|
||||||
|
.WithMany("RetirementPeriodHistorys")
|
||||||
|
.HasForeignKey("RetirementPeriodId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("RetirementPeriod");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementProfile", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementProfile", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||||
|
|
@ -12053,6 +12151,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("RetirementPeriodHistorys");
|
||||||
|
|
||||||
b.Navigation("RetirementProfiles");
|
b.Navigation("RetirementProfiles");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using MimeTypes;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
|
|
@ -265,15 +266,15 @@ namespace BMA.EHR.Application.Repositories
|
||||||
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents);
|
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents);
|
||||||
//var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName);
|
//var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName);
|
||||||
var fileExt = Path.GetExtension(fileName);
|
var fileExt = Path.GetExtension(fileName);
|
||||||
// var fileType = MimeTypeMap.GetMimeType(fileExt);
|
var fileType = MimeTypeMap.GetMimeType(fileExt);
|
||||||
var file_name = Path.GetFileName(fileName);
|
// var file_name = Path.GetFileName(fileName);
|
||||||
|
|
||||||
var request = new PutObjectRequest
|
var request = new PutObjectRequest
|
||||||
{
|
{
|
||||||
BucketName = $"{_bucketName}{subFolder}",
|
BucketName = $"{_bucketName}{subFolder}",
|
||||||
Key = file_name,
|
Key = fileName,
|
||||||
InputStream = filestream,
|
InputStream = filestream,
|
||||||
// ContentType = fileType,
|
ContentType = fileType,
|
||||||
CannedACL = S3CannedACL.PublicRead
|
CannedACL = S3CannedACL.PublicRead
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
"Endpoint": "https://s3.frappet.com/",
|
"Endpoint": "https://s3cluster.frappet.com/",
|
||||||
"AccessKey": "frappet",
|
"AccessKey": "frappet",
|
||||||
"SecretKey": "P@ssw0rd",
|
"SecretKey": "FPTadmin2357",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-ehr-fpt"
|
||||||
},
|
},
|
||||||
"Protocol": "HTTPS"
|
"Protocol": "HTTPS"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,28 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
Year = x.Year,
|
Year = x.Year,
|
||||||
Round = x.Round,
|
Round = x.Round,
|
||||||
Total = x.Total,
|
Total = x.Total,
|
||||||
|
Json = true,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
var retire = await _context.RetirementPeriods
|
||||||
|
.Include(x => x.RetirementProfiles)
|
||||||
|
.Where(x => x.Year == year)
|
||||||
|
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (retire != null)
|
||||||
|
{
|
||||||
|
retire_old.Add(new
|
||||||
|
{
|
||||||
|
Id = retire.Id,
|
||||||
|
CreatedAt = retire.CreatedAt,
|
||||||
|
Year = retire.Year,
|
||||||
|
Round = retire.Round,
|
||||||
|
Total = retire.RetirementProfiles.Count(),
|
||||||
|
Json = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Success(retire_old);
|
return Success(retire_old);
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -224,7 +244,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
var data = new RetirementProfile
|
var data = new RetirementProfile
|
||||||
{
|
{
|
||||||
Order = order,
|
Order = order,
|
||||||
Remove = "pending",
|
Remove = "PENDING",
|
||||||
RetirementPeriod = retire,
|
RetirementPeriod = retire,
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
|
|
@ -244,8 +264,32 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
if (req.Option == null)
|
if (req.Option == null)
|
||||||
req.Option = "EDIT";
|
req.Option = "EDIT";
|
||||||
var file_name = DateTime.Now.ToString();
|
var file_name = DateTime.Now.ToString("yyyyMMddTHHmmss");
|
||||||
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(retire.RetirementProfiles);
|
var profile_old = await _context.RetirementProfiles
|
||||||
|
.Where(x => x.RetirementPeriod == retire)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Order = x.Order,
|
||||||
|
Id = x.Id,
|
||||||
|
Reason = x.Reason,
|
||||||
|
Remove = x.Remove,
|
||||||
|
ProfileId = x.Profile.Id,
|
||||||
|
CitizenId = x.Profile.CitizenId,
|
||||||
|
Prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name,
|
||||||
|
FullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
||||||
|
OrganizationOrganization = x.Profile.OrganizationOrganization,
|
||||||
|
Oc = x.Profile.Oc,
|
||||||
|
Position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||||
|
PositionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name,
|
||||||
|
PositionExecutive = x.Profile.PositionExecutive,
|
||||||
|
PosNo = x.Profile.PosNo == null ? null : x.Profile.PosNo.Name,
|
||||||
|
PositionEmployeePosition = x.Profile.PositionEmployeePosition,
|
||||||
|
PositionEmployeeLevel = x.Profile.PositionEmployeeLevel,
|
||||||
|
PositionEmployeeGroup = x.Profile.PositionEmployeeGroup,
|
||||||
|
PosNoEmployee = x.Profile.PosNoEmployee,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(profile_old);
|
||||||
await _documentService.GenerateJsonFile(profile, "/retire", file_name);
|
await _documentService.GenerateJsonFile(profile, "/retire", file_name);
|
||||||
var history = new RetirementPeriodHistory
|
var history = new RetirementPeriodHistory
|
||||||
{
|
{
|
||||||
|
|
@ -271,15 +315,41 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
retire.LastUpdateFullName = FullName ?? "System Administrator";
|
retire.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
retire.LastUpdateUserId = UserId ?? "";
|
retire.LastUpdateUserId = UserId ?? "";
|
||||||
retire.LastUpdatedAt = DateTime.Now;
|
retire.LastUpdatedAt = DateTime.Now;
|
||||||
// RetireHistoryId
|
_context.RetirementProfiles.RemoveRange(retire.RetirementProfiles);
|
||||||
////ดึงไฟล์json
|
|
||||||
// foreach (var retire_profile in retire.RetirementProfiles)
|
if (!req.Option.Trim().ToUpper().Contains("ADD"))
|
||||||
// {
|
{
|
||||||
// retire_profile.Remove = retire_profile.Remove.Trim().ToUpper().Contains("CHANGE") ? "PENDING" : retire_profile.Remove;
|
var profileHistorys = await _context.RetirementPeriodHistorys.AsQueryable()
|
||||||
// retire_profile.LastUpdateFullName = FullName ?? "System Administrator";
|
.FirstOrDefaultAsync(x => x.Id == req.RetireHistoryId);
|
||||||
// retire_profile.LastUpdateUserId = UserId ?? "";
|
if (profileHistorys == null)
|
||||||
// retire_profile.LastUpdatedAt = DateTime.Now;
|
return Error(GlobalMessages.InvalidRetirementHistoryRequest, 404);
|
||||||
// }
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
var url = $"https://s3cluster.frappet.com/bma-ehr-fpt/retire/{profileHistorys.ProfileFile}";
|
||||||
|
var responseTask = client.GetAsync(url);
|
||||||
|
var results = responseTask.Result;
|
||||||
|
var profileOlds = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RetirementProfile>>(results.Content.ReadAsStringAsync().Result);
|
||||||
|
if (profileOlds != null)
|
||||||
|
{
|
||||||
|
foreach (var profileOld in profileOlds)
|
||||||
|
{
|
||||||
|
var data = new RetirementProfile
|
||||||
|
{
|
||||||
|
Order = profileOld.Order,
|
||||||
|
Remove = "PENDING",
|
||||||
|
RetirementPeriod = retire,
|
||||||
|
Profile = profileOld.Profile,
|
||||||
|
CreatedUserId = profileOld.CreatedUserId,
|
||||||
|
CreatedFullName = profileOld.CreatedFullName,
|
||||||
|
CreatedAt = profileOld.CreatedAt,
|
||||||
|
LastUpdateFullName = profileOld.LastUpdateFullName,
|
||||||
|
LastUpdateUserId = profileOld.LastUpdateUserId,
|
||||||
|
LastUpdatedAt = profileOld.LastUpdatedAt,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -323,12 +393,26 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpGet("{retireId:length(36)}")]
|
[HttpGet("{retireId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetProfileRetirement(Guid retireId)
|
public async Task<ActionResult<ResponseObject>> GetProfileRetirement(Guid retireId)
|
||||||
{
|
{
|
||||||
var retire = await _context.RetirementPeriodHistorys
|
var retire = await _context.RetirementPeriods
|
||||||
|
.Include(x => x.RetirementProfiles)
|
||||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
{
|
||||||
|
var profileHistorys = await _context.RetirementPeriodHistorys.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||||
|
if (profileHistorys == null)
|
||||||
|
return Error(GlobalMessages.InvalidRetirementHistoryRequest, 404);
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
var url = $"https://s3cluster.frappet.com/bma-ehr-fpt/retire/{profileHistorys.ProfileFile}";
|
||||||
|
var responseTask = client.GetAsync(url);
|
||||||
|
var results = responseTask.Result;
|
||||||
|
// Console.WriteLine(results.Content.ReadAsStringAsync().Result);
|
||||||
|
return Success(new { Json = true, profile = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RetirementProfile>>(results.Content.ReadAsStringAsync().Result) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Success(retire);
|
return Success(new { Json = false, profile = retire.RetirementProfiles });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -340,19 +424,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpDelete("profile/{retireProfileId:length(36)}")]
|
// [HttpDelete("profile/{retireProfileId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> DeleteProfileRetirement(Guid retireProfileId)
|
// public async Task<ActionResult<ResponseObject>> DeleteProfileRetirement(Guid retireProfileId)
|
||||||
{
|
// {
|
||||||
var profile = await _context.RetirementProfiles
|
// var profile = await _context.RetirementProfiles
|
||||||
.FirstOrDefaultAsync(x => x.Id == retireProfileId);
|
// .FirstOrDefaultAsync(x => x.Id == retireProfileId);
|
||||||
if (profile == null)
|
// if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
// return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
_context.RetirementProfiles.Remove(profile);
|
// _context.RetirementProfiles.Remove(profile);
|
||||||
_context.SaveChanges();
|
// _context.SaveChanges();
|
||||||
|
|
||||||
return Success();
|
// return Success();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add รายชื่อผู้เกษียณอายุราชการในประกาศ
|
/// Add รายชื่อผู้เกษียณอายุราชการในประกาศ
|
||||||
|
|
@ -427,7 +511,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPost("reason")]
|
[HttpPost("edit")]
|
||||||
public async Task<ActionResult<ResponseObject>> EditReasonProfileRetirement([FromBody] ProfileRetireRequest req)
|
public async Task<ActionResult<ResponseObject>> EditReasonProfileRetirement([FromBody] ProfileRetireRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.RetirementProfiles
|
var profile = await _context.RetirementProfiles
|
||||||
|
|
@ -445,6 +529,44 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// แก้ไขข้อมูลบุคคล
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
||||||
|
/// <param name="reason">เหตุผล</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("remove")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> RemoveReasonProfileRetirement([FromBody] ProfileRetireRequest req)
|
||||||
|
{
|
||||||
|
var profile = await _context.RetirementProfiles
|
||||||
|
.Include(x => x.RetirementPeriod)
|
||||||
|
.ThenInclude(x => x.RetirementPeriodHistorys)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == req.RetireProfileId);
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
if (profile.RetirementPeriod.RetirementPeriodHistorys.Count() == 0)
|
||||||
|
{
|
||||||
|
await GenOrderByYear(profile.RetirementPeriod.Id);
|
||||||
|
_context.RetirementProfiles.Remove(profile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
profile.Remove = "REMOVE";
|
||||||
|
profile.Reason = req.Reason;
|
||||||
|
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// View เหตุผลแก้ไขข้อมูลบุคคล
|
/// View เหตุผลแก้ไขข้อมูลบุคคล
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
"Endpoint": "https://s3.frappet.com/",
|
"Endpoint": "https://s3cluster.frappet.com/",
|
||||||
"AccessKey": "frappet",
|
"AccessKey": "frappet",
|
||||||
"SecretKey": "P@ssw0rd",
|
"SecretKey": "FPTadmin2357",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-ehr-fpt"
|
||||||
},
|
},
|
||||||
"Protocol": "HTTPS"
|
"Protocol": "HTTPS"
|
||||||
}
|
}
|
||||||
1
BMA.EHR.Retirement.Service/tmp/20230803T123113
Normal file
1
BMA.EHR.Retirement.Service/tmp/20230803T123113
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
[{"Order":2,"Id":"08db93d9-a26b-4a93-8ecc-01f6bc4425b7","Reason":"","Remove":"PENDING","ProfileId":"08db721d-b171-45f1-845e-d78809081cfa","CitizenId":"0000000000053","Prefix":"นาย","FullName":"บล ตง","OrganizationOrganization":"กองพัฒนาระบบราชการกรุงเทพมหานคร","Oc":"ปลัดกรุงเทพมหานคร/สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองพัฒนาระบบราชการกรุงเทพมหานคร","Position":"ผู้อำนวยการ","PositionType":"อำนวยการ","PositionExecutive":"ผู้อำนวยการกอง","PosNo":"กพร.1","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":1,"Id":"08db93d9-a26f-4d4e-885e-c996514222f2","Reason":"","Remove":"PENDING","ProfileId":"08db721d-b438-414e-861a-bd74b2cc8b03","CitizenId":"0000000000088","Prefix":"นาง","FullName":"สจ สว","OrganizationOrganization":"ส่วนโครงสร้างและอัตรากำลัง","Oc":"ปลัดกรุงเทพมหานคร/สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองอัตรากำลัง/ส่วนโครงสร้างและอัตรากำลัง","Position":"ผู้อำนวยการ","PositionType":"อำนวยการ","PositionExecutive":"ผู้อำนวยการส่วน","PosNo":"กคอ.70","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":4,"Id":"08db93d9-a26f-4dbb-8afb-4bed0ac1c147","Reason":"","Remove":"PENDING","ProfileId":"08db721d-bb39-4902-8dab-dc582de20ab7","CitizenId":"0000000000209","Prefix":"นางสาว","FullName":"วณ มจ","OrganizationOrganization":"ฝ่ายบริหารงานทั่วไป","Oc":"ปลัดกรุงเทพมหานคร/สำนักปลัดกรุงเทพมหานคร/สถาบันพัฒนาข้าราชการกรุงเทพมหานคร/ฝ่ายบริหารงานทั่วไป","Position":"เจ้าพนักงานธุรการ","PositionType":"ทั่วไป","PositionExecutive":null,"PosNo":"สพข.15","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":3,"Id":"08db93d9-a26f-4ddf-8c67-3ce67296b477","Reason":"","Remove":"PENDING","ProfileId":"08db721d-c0f0-4a43-820e-0d505da95a20","CitizenId":"0000000000301","Prefix":"นางสาว","FullName":"มร พจ","OrganizationOrganization":"ศูนย์การเรียนรู้มหานคร","Oc":"ปลัดกรุงเทพมหานคร/สำนักปลัดกรุงเทพมหานคร/สถาบันพัฒนาข้าราชการกรุงเทพมหานคร/ศูนย์การเรียนรู้มหานคร","Position":"นักจัดการงานทั่วไป","PositionType":"วิชาการ","PositionExecutive":"ผู้อำนวยการศูนย์","PosNo":"สพข.107","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null}]
|
||||||
1
BMA.EHR.Retirement.Service/tmp/20230803T123303
Normal file
1
BMA.EHR.Retirement.Service/tmp/20230803T123303
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
[{"Order":2,"Id":"08db93d9-a26b-4a93-8ecc-01f6bc4425b7","Reason":"","Remove":"PENDING","ProfileId":"08db721d-b171-45f1-845e-d78809081cfa","CitizenId":"0000000000053","Prefix":"นาย","FullName":"บล ตง","OrganizationOrganization":"กองพัฒนาระบบราชการกรุงเทพมหานคร","Oc":"ปลัดกรุงเทพมหานคร/สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองพัฒนาระบบราชการกรุงเทพมหานคร","Position":"ผู้อำนวยการ","PositionType":"อำนวยการ","PositionExecutive":"ผู้อำนวยการกอง","PosNo":"กพร.1","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":1,"Id":"08db93d9-a26f-4d4e-885e-c996514222f2","Reason":"","Remove":"PENDING","ProfileId":"08db721d-b438-414e-861a-bd74b2cc8b03","CitizenId":"0000000000088","Prefix":"นาง","FullName":"สจ สว","OrganizationOrganization":"ส่วนโครงสร้างและอัตรากำลัง","Oc":"ปลัดกรุงเทพมหานคร/สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองอัตรากำลัง/ส่วนโครงสร้างและอัตรากำลัง","Position":"ผู้อำนวยการ","PositionType":"อำนวยการ","PositionExecutive":"ผู้อำนวยการส่วน","PosNo":"กคอ.70","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":4,"Id":"08db93d9-a26f-4dbb-8afb-4bed0ac1c147","Reason":"","Remove":"PENDING","ProfileId":"08db721d-bb39-4902-8dab-dc582de20ab7","CitizenId":"0000000000209","Prefix":"นางสาว","FullName":"วณ มจ","OrganizationOrganization":"ฝ่ายบริหารงานทั่วไป","Oc":"ปลัดกรุงเทพมหานคร/สำนักปลัดกรุงเทพมหานคร/สถาบันพัฒนาข้าราชการกรุงเทพมหานคร/ฝ่ายบริหารงานทั่วไป","Position":"เจ้าพนักงานธุรการ","PositionType":"ทั่วไป","PositionExecutive":null,"PosNo":"สพข.15","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":3,"Id":"08db93d9-a26f-4ddf-8c67-3ce67296b477","Reason":"","Remove":"PENDING","ProfileId":"08db721d-c0f0-4a43-820e-0d505da95a20","CitizenId":"0000000000301","Prefix":"นางสาว","FullName":"มร พจ","OrganizationOrganization":"ศูนย์การเรียนรู้มหานคร","Oc":"ปลัดกรุงเทพมหานคร/สำนักปลัดกรุงเทพมหานคร/สถาบันพัฒนาข้าราชการกรุงเทพมหานคร/ศูนย์การเรียนรู้มหานคร","Position":"นักจัดการงานทั่วไป","PositionType":"วิชาการ","PositionExecutive":"ผู้อำนวยการศูนย์","PosNo":"สพข.107","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null}]
|
||||||
1
BMA.EHR.Retirement.Service/tmp/20230803T123810
Normal file
1
BMA.EHR.Retirement.Service/tmp/20230803T123810
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
[{"Order":2,"Id":"08db93d9-a26b-4a93-8ecc-01f6bc4425b7","Reason":"","Remove":"PENDING","ProfileId":"08db721d-b171-45f1-845e-d78809081cfa","CitizenId":"0000000000053","Prefix":"นาย","FullName":"บล ตง","OrganizationOrganization":"กองพัฒนาระบบราชการกรุงเทพมหานคร","Oc":"ปลัดกรุงเทพมหานคร/สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองพัฒนาระบบราชการกรุงเทพมหานคร","Position":"ผู้อำนวยการ","PositionType":"อำนวยการ","PositionExecutive":"ผู้อำนวยการกอง","PosNo":"กพร.1","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":1,"Id":"08db93d9-a26f-4d4e-885e-c996514222f2","Reason":"","Remove":"PENDING","ProfileId":"08db721d-b438-414e-861a-bd74b2cc8b03","CitizenId":"0000000000088","Prefix":"นาง","FullName":"สจ สว","OrganizationOrganization":"ส่วนโครงสร้างและอัตรากำลัง","Oc":"ปลัดกรุงเทพมหานคร/สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองอัตรากำลัง/ส่วนโครงสร้างและอัตรากำลัง","Position":"ผู้อำนวยการ","PositionType":"อำนวยการ","PositionExecutive":"ผู้อำนวยการส่วน","PosNo":"กคอ.70","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":4,"Id":"08db93d9-a26f-4dbb-8afb-4bed0ac1c147","Reason":"","Remove":"PENDING","ProfileId":"08db721d-bb39-4902-8dab-dc582de20ab7","CitizenId":"0000000000209","Prefix":"นางสาว","FullName":"วณ มจ","OrganizationOrganization":"ฝ่ายบริหารงานทั่วไป","Oc":"ปลัดกรุงเทพมหานคร/สำนักปลัดกรุงเทพมหานคร/สถาบันพัฒนาข้าราชการกรุงเทพมหานคร/ฝ่ายบริหารงานทั่วไป","Position":"เจ้าพนักงานธุรการ","PositionType":"ทั่วไป","PositionExecutive":null,"PosNo":"สพข.15","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null},{"Order":3,"Id":"08db93d9-a26f-4ddf-8c67-3ce67296b477","Reason":"","Remove":"PENDING","ProfileId":"08db721d-c0f0-4a43-820e-0d505da95a20","CitizenId":"0000000000301","Prefix":"นางสาว","FullName":"มร พจ","OrganizationOrganization":"ศูนย์การเรียนรู้มหานคร","Oc":"ปลัดกรุงเทพมหานคร/สำนักปลัดกรุงเทพมหานคร/สถาบันพัฒนาข้าราชการกรุงเทพมหานคร/ศูนย์การเรียนรู้มหานคร","Position":"นักจัดการงานทั่วไป","PositionType":"วิชาการ","PositionExecutive":"ผู้อำนวยการศูนย์","PosNo":"สพข.107","PositionEmployeePosition":null,"PositionEmployeeLevel":null,"PositionEmployeeGroup":null,"PosNoEmployee":null}]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue