Merge branch 'develop' into adiDev
Some checks failed
release-dev / release-dev (push) Failing after 12s
Some checks failed
release-dev / release-dev (push) Failing after 12s
This commit is contained in:
commit
3779128e6c
26 changed files with 1912 additions and 191 deletions
|
|
@ -400,9 +400,43 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
p.RemarkHorizontal,
|
p.RemarkHorizontal,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
if (data == null)
|
||||||
|
data = await _dbContext.Set<RetirementResignEmployee>().AsQueryable()
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.profileId,
|
||||||
|
p.Location,
|
||||||
|
p.SendDate,
|
||||||
|
p.ActiveDate,
|
||||||
|
p.Reason,
|
||||||
|
p.Status,
|
||||||
|
salary = p.AmountOld,
|
||||||
|
p.ApproveReason,
|
||||||
|
p.RejectReason,
|
||||||
|
p.IsActive,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.PositionTypeOld,
|
||||||
|
p.PositionLevelOld,
|
||||||
|
p.PositionNumberOld,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.OligarchReject,
|
||||||
|
p.OligarchApproveReason,
|
||||||
|
p.OligarchRejectReason,
|
||||||
|
p.OligarchRejectDate,
|
||||||
|
p.CommanderReject,
|
||||||
|
p.CommanderApproveReason,
|
||||||
|
p.CommanderRejectReason,
|
||||||
|
p.CommanderRejectDate,
|
||||||
|
p.RemarkHorizontal,
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var _data = new
|
var _data = new
|
||||||
{
|
{
|
||||||
data.Id,
|
data.Id,
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
// use serilog
|
// use serilog
|
||||||
ConfigureLogs();
|
//ConfigureLogs();
|
||||||
builder.Host.UseSerilog();
|
//builder.Host.UseSerilog();
|
||||||
|
|
||||||
// Add config CORS
|
// Add config CORS
|
||||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||||
|
|
@ -154,6 +154,8 @@ var app = builder.Build();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||||
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
||||||
|
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||||
{
|
{
|
||||||
Authorization = new[] { new CustomAuthorizeFilter() }
|
Authorization = new[] { new CustomAuthorizeFilter() }
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,53 @@
|
||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Warning"
|
"System": "Warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ElasticConfiguration": {
|
"ElasticConfiguration": {
|
||||||
"Uri": "http://localhost:9200"
|
"Uri": "http://192.168.1.40:9200",
|
||||||
},
|
"IndexFormat": "bma-ehr-log-index",
|
||||||
"AllowedHosts": "*",
|
"SystemName": "discipline"
|
||||||
"ConnectionStrings": {
|
},
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
"AllowedHosts": "*",
|
||||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
"ConnectionStrings": {
|
||||||
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
},
|
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"Jwt": {
|
"DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
},
|
||||||
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
"Jwt": {
|
||||||
},
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"EPPlus": {
|
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
||||||
"ExcelPackage": {
|
},
|
||||||
"LicenseContext": "NonCommercial"
|
"EPPlus": {
|
||||||
}
|
"ExcelPackage": {
|
||||||
},
|
"LicenseContext": "NonCommercial"
|
||||||
"MinIO": {
|
}
|
||||||
"Endpoint": "https://edm-s3.frappet.synology.me/",
|
},
|
||||||
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
|
"MinIO": {
|
||||||
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
|
"Endpoint": "https://edm-s3.frappet.synology.me/",
|
||||||
"BucketName": "bma-ehr-fpt"
|
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
|
||||||
},
|
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
|
||||||
"Mail": {
|
"BucketName": "bma-ehr-fpt"
|
||||||
"Server": "smtp.gmail.com",
|
},
|
||||||
"User": "suphonchai.ph@gmail.com",
|
"Mail": {
|
||||||
"Password": "nnjazjcnwhepkxdm",
|
"Server": "smtp.gmail.com",
|
||||||
"MailFrom": "suphonchai.ph@gmail.com",
|
"User": "suphonchai.ph@gmail.com",
|
||||||
"Port": "587"
|
"Password": "nnjazjcnwhepkxdm",
|
||||||
},
|
"MailFrom": "suphonchai.ph@gmail.com",
|
||||||
"KeycloakCron": {
|
"Port": "587"
|
||||||
"Hour": "08",
|
},
|
||||||
"Minute": "00"
|
"KeycloakCron": {
|
||||||
},
|
"Hour": "08",
|
||||||
"Protocol": "HTTPS",
|
"Minute": "00"
|
||||||
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
},
|
||||||
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
"Protocol": "HTTPS",
|
||||||
|
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
||||||
|
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
||||||
}
|
}
|
||||||
|
|
@ -1,49 +1,122 @@
|
||||||
using Microsoft.AspNetCore.Http;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
using Nest;
|
using Nest;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||||
|
|
||||||
namespace BMA.EHR.Domain.Middlewares
|
namespace BMA.EHR.Domain.Middlewares
|
||||||
{
|
{
|
||||||
public class RequestLoggingMiddleware
|
public class RequestLoggingMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public RequestLoggingMiddleware(RequestDelegate next)
|
private string Uri = "";
|
||||||
|
private string IndexFormat = "";
|
||||||
|
private string SystemName = "";
|
||||||
|
private string APIKey = "";
|
||||||
|
|
||||||
|
public RequestLoggingMiddleware(RequestDelegate next, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_next = next;
|
_next = next;
|
||||||
|
_configuration = configuration;
|
||||||
|
|
||||||
|
Uri = _configuration["ElasticConfiguration:Uri"] ?? "http://192.168.1.40:9200";
|
||||||
|
IndexFormat = _configuration["ElasticConfiguration:IndexFormat"] ?? "bma-ehr-log-index";
|
||||||
|
SystemName = _configuration["ElasticConfiguration:SystemName"] ?? "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<string> GetExternalAPIAsync(string apiPath, string accessToken, string apiKey)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
||||||
|
var _res = await client.GetAsync(apiPath);
|
||||||
|
if (_res.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
return _result;
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetProfileByKeycloakIdLocal?> GetProfileByKeycloakIdAsync(Guid keycloakId, string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak/{keycloakId}";
|
||||||
|
var apiKey = _configuration["API_KEY"];
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultLocal>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Invoke(HttpContext context)
|
public async Task Invoke(HttpContext context)
|
||||||
{
|
{
|
||||||
var settings = new ConnectionSettings(new Uri("http://192.168.1.40:9200"))
|
var settings = new ConnectionSettings(new Uri(Uri))
|
||||||
.DefaultIndex("bma-ehr-log-test-net");
|
.DefaultIndex(IndexFormat);
|
||||||
|
|
||||||
var client = new ElasticClient(settings);
|
var client = new ElasticClient(settings);
|
||||||
|
|
||||||
|
|
||||||
var startTime = DateTime.UtcNow;
|
var startTime = DateTime.UtcNow;
|
||||||
var stopwatch = Stopwatch.StartNew();
|
var stopwatch = Stopwatch.StartNew();
|
||||||
|
string? responseBodyJson = null;
|
||||||
|
string? requestBodyJson = null;
|
||||||
|
|
||||||
string requestBody = await ReadRequestBodyAsync(context);
|
string requestBody = await ReadRequestBodyAsync(context);
|
||||||
|
if (requestBody != "")
|
||||||
|
requestBodyJson = JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(requestBody), new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, WriteIndented = true });
|
||||||
|
|
||||||
|
|
||||||
var originalBodyStream = context.Response.Body;
|
var originalBodyStream = context.Response.Body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (var memoryStream = new MemoryStream())
|
using (var memoryStream = new MemoryStream())
|
||||||
{
|
{
|
||||||
// เปลี่ยน stream ของ Response เพื่อให้สามารถอ่านได้
|
// เปลี่ยน stream ของ Response เพื่อให้สามารถอ่านได้
|
||||||
context.Response.Body = memoryStream;
|
context.Response.Body = memoryStream;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var keycloakId = context.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? Guid.Empty.ToString("D");
|
||||||
|
var token = context.Request.Headers["Authorization"];
|
||||||
|
|
||||||
|
var pf = await GetProfileByKeycloakIdAsync(Guid.Parse(keycloakId), token);
|
||||||
|
|
||||||
await _next(context); // ดำเนินการต่อไปยัง Middleware อื่น ๆ
|
await _next(context); // ดำเนินการต่อไปยัง Middleware อื่น ๆ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
var processTime = stopwatch.ElapsedMilliseconds;
|
var processTime = stopwatch.ElapsedMilliseconds;
|
||||||
var endTime = DateTime.UtcNow;
|
var endTime = DateTime.UtcNow;
|
||||||
|
|
@ -55,16 +128,26 @@ namespace BMA.EHR.Domain.Middlewares
|
||||||
_ => "info"
|
_ => "info"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
string? message = null;
|
||||||
|
|
||||||
// อ่านข้อมูลจาก Response หลังจากที่ได้ถูกส่งออกไป
|
// อ่านข้อมูลจาก Response หลังจากที่ได้ถูกส่งออกไป
|
||||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||||
var responseBody = new StreamReader(memoryStream).ReadToEnd();
|
var responseBody = new StreamReader(memoryStream).ReadToEnd();
|
||||||
|
if (responseBody != "")
|
||||||
|
responseBodyJson = JsonSerializer.Serialize(JsonSerializer.Deserialize<object>(responseBody), new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, WriteIndented = true });
|
||||||
|
|
||||||
|
var json = JsonSerializer.Deserialize<JsonElement>(responseBody);
|
||||||
|
if (json.TryGetProperty("message", out var messageElement))
|
||||||
|
{
|
||||||
|
message = messageElement.GetString();
|
||||||
|
}
|
||||||
|
|
||||||
var logData = new
|
var logData = new
|
||||||
{
|
{
|
||||||
logType = logType,
|
logType = logType,
|
||||||
ip = context.Connection.RemoteIpAddress?.ToString(),
|
ip = context.Connection.RemoteIpAddress?.ToString(),
|
||||||
rootId = context.Items["RootId"] ?? null,
|
rootId = pf == null ? null : pf.RootId,
|
||||||
systemName = "test",
|
systemName = SystemName,
|
||||||
startTimeStamp = startTime.ToString("o"),
|
startTimeStamp = startTime.ToString("o"),
|
||||||
endTimeStamp = endTime.ToString("o"),
|
endTimeStamp = endTime.ToString("o"),
|
||||||
processTime = processTime,
|
processTime = processTime,
|
||||||
|
|
@ -72,9 +155,14 @@ namespace BMA.EHR.Domain.Middlewares
|
||||||
method = context.Request.Method,
|
method = context.Request.Method,
|
||||||
endpoint = context.Request.Path + context.Request.QueryString,
|
endpoint = context.Request.Path + context.Request.QueryString,
|
||||||
responseCode = context.Response.StatusCode == 304 ? "200" : context.Response.StatusCode.ToString(),
|
responseCode = context.Response.StatusCode == 304 ? "200" : context.Response.StatusCode.ToString(),
|
||||||
responseDescription = context.Items["ResponseMessage"] ?? null,
|
responseDescription = message,
|
||||||
input = requestBody,
|
input = requestBodyJson,
|
||||||
output = responseBody
|
output = responseBodyJson,
|
||||||
|
|
||||||
|
userId = keycloakId,
|
||||||
|
userName = $"{pf?.Prefix ?? ""}{pf?.FirstName ?? ""} {pf?.LastName ?? ""}",
|
||||||
|
user = pf?.CitizenId ?? ""
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// เขียนข้อมูลกลับไปยัง original Response body
|
// เขียนข้อมูลกลับไปยัง original Response body
|
||||||
|
|
@ -85,7 +173,7 @@ namespace BMA.EHR.Domain.Middlewares
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Log.Information("API Request Log: {@LogData}", logData);
|
//Log.Information("API Request Log: {@LogData}", logData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,4 +186,47 @@ namespace BMA.EHR.Domain.Middlewares
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetProfileByKeycloakIdLocal
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public string? Prefix { get; set; }
|
||||||
|
public string? FirstName { get; set; }
|
||||||
|
public string? LastName { get; set; }
|
||||||
|
public string? CitizenId { get; set; }
|
||||||
|
|
||||||
|
public string? Root { get; set; }
|
||||||
|
public string? Child1 { get; set; }
|
||||||
|
public string? Child2 { get; set; }
|
||||||
|
public string? Child3 { get; set; }
|
||||||
|
public string? Child4 { get; set; }
|
||||||
|
public Guid? RootId { get; set; }
|
||||||
|
public Guid? Child1Id { get; set; }
|
||||||
|
public Guid? Child2Id { get; set; }
|
||||||
|
public Guid? Child3Id { get; set; }
|
||||||
|
public Guid? Child4Id { get; set; }
|
||||||
|
public Guid? RootDnaId { get; set; }
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
|
public double? Amount { get; set; }
|
||||||
|
public double? PositionSalaryAmount { get; set; }
|
||||||
|
public string? Commander { get; set; }
|
||||||
|
|
||||||
|
public Guid? CommanderId { get; set; }
|
||||||
|
|
||||||
|
public Guid? CommanderKeycloak { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetProfileByKeycloakIdResultLocal
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public GetProfileByKeycloakIdLocal? Result { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
BMA.EHR.Domain/Models/Leave/Requests/LeaveBeginning.cs
Normal file
24
BMA.EHR.Domain/Models/Leave/Requests/LeaveBeginning.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.Leave.Commons;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.Leave.Requests
|
||||||
|
{
|
||||||
|
public class LeaveBeginning : EntityBase
|
||||||
|
{
|
||||||
|
[Required, Comment("รหัส Profile ในระบบทะเบียนประวัติ")]
|
||||||
|
public Guid ProfileId { get; set; } = Guid.Empty;
|
||||||
|
|
||||||
|
[Required, Comment("รหัสประเภทการลา")]
|
||||||
|
public Guid LeaveTypeId { get; set; } = Guid.Empty;
|
||||||
|
|
||||||
|
public LeaveType LeaveType { get; set; }
|
||||||
|
|
||||||
|
[Required, Comment("ปีงบประมาณ")]
|
||||||
|
public int LeaveYear { get; set; } = 0;
|
||||||
|
|
||||||
|
[Required, Comment("จำนวนวันลา")]
|
||||||
|
public double LeaveDays { get; set; } = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
1365
BMA.EHR.Infrastructure/Migrations/LeaveDb/20250326045016_Add Leave Beginning.Designer.cs
generated
Normal file
1365
BMA.EHR.Infrastructure/Migrations/LeaveDb/20250326045016_Add Leave Beginning.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,59 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddLeaveBeginning : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "LeaveBeginnings",
|
||||||
|
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"),
|
||||||
|
ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัส Profile ในระบบทะเบียนประวัติ", collation: "ascii_general_ci"),
|
||||||
|
LeaveTypeId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสประเภทการลา", collation: "ascii_general_ci"),
|
||||||
|
LeaveYear = table.Column<int>(type: "int", nullable: false, comment: "ปีงบประมาณ"),
|
||||||
|
LeaveDays = table.Column<double>(type: "double", nullable: false, comment: "จำนวนวันลา")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_LeaveBeginnings", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_LeaveBeginnings_LeaveTypes_LeaveTypeId",
|
||||||
|
column: x => x.LeaveTypeId,
|
||||||
|
principalTable: "LeaveTypes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_LeaveBeginnings_LeaveTypeId",
|
||||||
|
table: "LeaveBeginnings",
|
||||||
|
column: "LeaveTypeId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "LeaveBeginnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -119,6 +119,76 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
b.ToTable("LeaveTypes");
|
b.ToTable("LeaveTypes");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveBeginning", 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<double>("LeaveDays")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("จำนวนวันลา");
|
||||||
|
|
||||||
|
b.Property<Guid>("LeaveTypeId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัสประเภทการลา");
|
||||||
|
|
||||||
|
b.Property<int>("LeaveYear")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("ปีงบประมาณ");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProfileId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("LeaveTypeId");
|
||||||
|
|
||||||
|
b.ToTable("LeaveBeginnings");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveDocument", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveDocument", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -1218,6 +1288,17 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
b.ToTable("UserTimeStamps");
|
b.ToTable("UserTimeStamps");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveBeginning", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "LeaveType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("LeaveTypeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("LeaveType");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveDocument", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveDocument", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
|
|
||||||
public DbSet<LeaveDocument> LeaveDocuments { get; set; }
|
public DbSet<LeaveDocument> LeaveDocuments { get; set; }
|
||||||
|
|
||||||
|
public DbSet<LeaveBeginning> LeaveBeginnings { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.32.0" />
|
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.32.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||||
|
<PackageReference Include="NEST" Version="7.17.5" />
|
||||||
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
|
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
|
||||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
// use serilog
|
// use serilog
|
||||||
ConfigureLogs();
|
//ConfigureLogs();
|
||||||
builder.Host.UseSerilog();
|
//builder.Host.UseSerilog();
|
||||||
|
|
||||||
// Add config CORS
|
// Add config CORS
|
||||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ElasticConfiguration": {
|
"ElasticConfiguration": {
|
||||||
"Uri": "http://192.168.1.40:9200"
|
"Uri": "http://192.168.1.40:9200",
|
||||||
|
"IndexFormat": "bma-ehr-log-index",
|
||||||
|
"SystemName": "insignia"
|
||||||
},
|
},
|
||||||
"LogIndex": "bma-ehr-log-index",
|
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ app.UseStaticFiles();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||||
// Disable ก่อน เพื่อแก้ไขให้เรีบร้อยก่อนการใช้งาน
|
// Disable ก่อน เพื่อแก้ไขให้เรีบร้อยก่อนการใช้งาน
|
||||||
// app.UseMiddleware<RequestLoggingMiddleware>();
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
||||||
|
|
||||||
|
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ElasticConfiguration": {
|
"ElasticConfiguration": {
|
||||||
"Uri": "http://localhost:9200"
|
"Uri": "http://192.168.1.40:9200",
|
||||||
|
"IndexFormat": "bma-ehr-log-index",
|
||||||
|
"SystemName": "leave"
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
|
|
|
||||||
|
|
@ -574,6 +574,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
uppdated.positionId = req.positionId;
|
uppdated.positionId = req.positionId;
|
||||||
uppdated.posMasterNo = req.posMasterNo;
|
uppdated.posMasterNo = req.posMasterNo;
|
||||||
uppdated.position = req.positionName;
|
uppdated.position = req.positionName;
|
||||||
|
uppdated.PositionExecutive = req.posExecutiveName;
|
||||||
uppdated.positionField = req.positionField;
|
uppdated.positionField = req.positionField;
|
||||||
uppdated.posTypeId = req.posTypeId;
|
uppdated.posTypeId = req.posTypeId;
|
||||||
uppdated.posTypeName = req.posTypeName;
|
uppdated.posTypeName = req.posTypeName;
|
||||||
|
|
|
||||||
|
|
@ -968,6 +968,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
person.positionId = req.positionId;
|
person.positionId = req.positionId;
|
||||||
person.posMasterNo = req.posMasterNo;
|
person.posMasterNo = req.posMasterNo;
|
||||||
person.positionName = req.positionName;
|
person.positionName = req.positionName;
|
||||||
|
person.PositionExecutive = req.posExecutiveName;
|
||||||
person.positionField = req.positionField;
|
person.positionField = req.positionField;
|
||||||
person.posTypeId = req.posTypeId;
|
person.posTypeId = req.posTypeId;
|
||||||
person.posTypeName = req.posTypeName;
|
person.posTypeName = req.posTypeName;
|
||||||
|
|
|
||||||
|
|
@ -673,6 +673,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
uppdated.positionId = req.positionId;
|
uppdated.positionId = req.positionId;
|
||||||
uppdated.posMasterNo = req.posMasterNo;
|
uppdated.posMasterNo = req.posMasterNo;
|
||||||
uppdated.position = req.positionName;
|
uppdated.position = req.positionName;
|
||||||
|
uppdated.PositionExecutive = req.posExecutiveName;
|
||||||
uppdated.positionField = req.positionField;
|
uppdated.positionField = req.positionField;
|
||||||
uppdated.posTypeId = req.posTypeId;
|
uppdated.posTypeId = req.posTypeId;
|
||||||
uppdated.posTypeName = req.posTypeName;
|
uppdated.posTypeName = req.posTypeName;
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
// use serilog
|
// use serilog
|
||||||
ConfigureLogs();
|
//ConfigureLogs();
|
||||||
builder.Host.UseSerilog();
|
//builder.Host.UseSerilog();
|
||||||
|
|
||||||
// Add config CORS
|
// Add config CORS
|
||||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||||
|
|
@ -153,6 +153,8 @@ var app = builder.Build();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||||
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
||||||
|
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||||
{
|
{
|
||||||
Authorization = new[] { new CustomAuthorizeFilter() }
|
Authorization = new[] { new CustomAuthorizeFilter() }
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,6 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
public string? posLevelId { get; set; }
|
public string? posLevelId { get; set; }
|
||||||
public string? posLevelName { get; set; }
|
public string? posLevelName { get; set; }
|
||||||
public string? typeCommand { get; set; }
|
public string? typeCommand { get; set; }
|
||||||
|
public string? posExecutiveName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,5 +29,6 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
public string? posLevelId { get; set; }
|
public string? posLevelId { get; set; }
|
||||||
public string? posLevelName { get; set; }
|
public string? posLevelName { get; set; }
|
||||||
public string? typeCommand { get; set; }
|
public string? typeCommand { get; set; }
|
||||||
|
public string? posExecutiveName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,5 +38,6 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
public string? posLevelId { get; set; }
|
public string? posLevelId { get; set; }
|
||||||
public string? posLevelName { get; set; }
|
public string? posLevelName { get; set; }
|
||||||
public string? typeCommand { get; set; }
|
public string? typeCommand { get; set; }
|
||||||
|
public string? posExecutiveName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,49 +1,51 @@
|
||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Warning"
|
"System": "Warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ElasticConfiguration": {
|
"ElasticConfiguration": {
|
||||||
"Uri": "http://localhost:9200"
|
"Uri": "http://192.168.1.40:9200",
|
||||||
},
|
"IndexFormat": "bma-ehr-log-index",
|
||||||
"AllowedHosts": "*",
|
"SystemName": "placement"
|
||||||
"ConnectionStrings": {
|
},
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
"AllowedHosts": "*",
|
||||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"ConnectionStrings": {
|
||||||
},
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
"Jwt": {
|
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
},
|
||||||
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
"Jwt": {
|
||||||
},
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"EPPlus": {
|
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
||||||
"ExcelPackage": {
|
},
|
||||||
"LicenseContext": "NonCommercial"
|
"EPPlus": {
|
||||||
}
|
"ExcelPackage": {
|
||||||
},
|
"LicenseContext": "NonCommercial"
|
||||||
"MinIO": {
|
}
|
||||||
"Endpoint": "https://edm-s3.frappet.synology.me/",
|
},
|
||||||
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
|
"MinIO": {
|
||||||
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
|
"Endpoint": "https://edm-s3.frappet.synology.me/",
|
||||||
"BucketName": "bma-ehr-fpt"
|
"AccessKey": "XxtdnJajPjp3hHuKdOMn",
|
||||||
},
|
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
|
||||||
"KeycloakCron": {
|
"BucketName": "bma-ehr-fpt"
|
||||||
"Hour": "08",
|
},
|
||||||
"Minute": "00"
|
"KeycloakCron": {
|
||||||
},
|
"Hour": "08",
|
||||||
"Mail": {
|
"Minute": "00"
|
||||||
"Server": "smtp.gmail.com",
|
},
|
||||||
"User": "suphonchai.ph@gmail.com",
|
"Mail": {
|
||||||
"Password": "nnjazjcnwhepkxdm",
|
"Server": "smtp.gmail.com",
|
||||||
"MailFrom": "suphonchai.ph@gmail.com",
|
"User": "suphonchai.ph@gmail.com",
|
||||||
"Port": "587"
|
"Password": "nnjazjcnwhepkxdm",
|
||||||
},
|
"MailFrom": "suphonchai.ph@gmail.com",
|
||||||
"Protocol": "HTTPS",
|
"Port": "587"
|
||||||
"APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation",
|
},
|
||||||
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
"Protocol": "HTTPS",
|
||||||
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
"APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation",
|
||||||
|
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
||||||
|
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
||||||
}
|
}
|
||||||
|
|
@ -553,6 +553,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (retirementDeceased == null)
|
if (retirementDeceased == null)
|
||||||
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
||||||
|
|
||||||
|
bool checkDup = req.Persons.Any(x => retirementDeceased.RetirementDeceasedNotis.Any(y => y.profileId == x.ProfileId));
|
||||||
|
if (checkDup)
|
||||||
|
return Error("ไม่สามารถเพิ่มรายชื่อส่งหนังสือเวียนซ้ำได้", 404);
|
||||||
|
|
||||||
foreach (var item in req.Persons)
|
foreach (var item in req.Persons)
|
||||||
{
|
{
|
||||||
// var profile = await _context.Profiles.AsQueryable()
|
// var profile = await _context.Profiles.AsQueryable()
|
||||||
|
|
@ -574,8 +578,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
if (retirementDeceased.profileType.Trim().ToUpper() == "OFFICER")
|
//if (retirementDeceased.profileType.Trim().ToUpper() == "OFFICER")
|
||||||
{
|
//{
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{item.ProfileId}";
|
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{item.ProfileId}";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
|
|
@ -602,36 +606,36 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
(org.result.root == null ? "" : org.result.root);
|
(org.result.root == null ? "" : org.result.root);
|
||||||
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile-employee/profileid/position/{item.ProfileId}";
|
// var apiUrl = $"{_configuration["API"]}/org/profile-employee/profileid/position/{item.ProfileId}";
|
||||||
using (var client = new HttpClient())
|
// using (var client = new HttpClient())
|
||||||
{
|
// {
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
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);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
// var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
|
// var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
// if (org == null || org.result == null)
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
retirementDeceasedNoti.Prefix = org.result.prefix == null ? "" : org.result.prefix;
|
// retirementDeceasedNoti.Prefix = org.result.prefix == null ? "" : org.result.prefix;
|
||||||
retirementDeceasedNoti.FirstName = org.result.firstName == null ? "" : org.result.firstName;
|
// retirementDeceasedNoti.FirstName = org.result.firstName == null ? "" : org.result.firstName;
|
||||||
retirementDeceasedNoti.LastName = org.result.lastName == null ? "" : org.result.lastName;
|
// retirementDeceasedNoti.LastName = org.result.lastName == null ? "" : org.result.lastName;
|
||||||
retirementDeceasedNoti.CitizenId = org.result.citizenId == null ? "" : org.result.citizenId;
|
// retirementDeceasedNoti.CitizenId = org.result.citizenId == null ? "" : org.result.citizenId;
|
||||||
retirementDeceasedNoti.PositionName = org.result.position == null ? "" : org.result.position;
|
// retirementDeceasedNoti.PositionName = org.result.position == null ? "" : org.result.position;
|
||||||
retirementDeceasedNoti.OrganizationName = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
|
// retirementDeceasedNoti.OrganizationName = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
|
||||||
(org.result.child3 == null ? "" : org.result.child3 + "\n") +
|
// (org.result.child3 == null ? "" : org.result.child3 + "\n") +
|
||||||
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
|
// (org.result.child2 == null ? "" : org.result.child2 + "\n") +
|
||||||
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
|
// (org.result.child1 == null ? "" : org.result.child1 + "\n") +
|
||||||
(org.result.root == null ? "" : org.result.root);
|
// (org.result.root == null ? "" : org.result.root);
|
||||||
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
// retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
p.IsActive,
|
p.IsActive,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (status != null && status.Trim().ToUpper() != "WAITTING")
|
//if (status != null && status.Trim().ToUpper() != "WAITTING")
|
||||||
|
if (status != null)
|
||||||
retirementOuts = retirementOuts.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
retirementOuts = retirementOuts.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||||
return Success(retirementOuts);
|
return Success(retirementOuts);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
// use serilog
|
// use serilog
|
||||||
ConfigureLogs();
|
//ConfigureLogs();
|
||||||
builder.Host.UseSerilog();
|
//builder.Host.UseSerilog();
|
||||||
|
|
||||||
// Add config CORS
|
// Add config CORS
|
||||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||||
|
|
@ -161,6 +161,7 @@ var app = builder.Build();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||||
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
||||||
|
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,42 @@
|
||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Warning"
|
"System": "Warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ElasticConfiguration": {
|
"ElasticConfiguration": {
|
||||||
"Uri": "http://localhost:9200"
|
"Uri": "http://192.168.1.40:9200",
|
||||||
},
|
"IndexFormat": "bma-ehr-log-index",
|
||||||
"AllowedHosts": "*",
|
"SystemName": "retirement"
|
||||||
"ConnectionStrings": {
|
},
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
"AllowedHosts": "*",
|
||||||
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
"DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"Jwt": {
|
"DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
},
|
||||||
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
"Jwt": {
|
||||||
},
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"EPPlus": {
|
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
||||||
"ExcelPackage": {
|
},
|
||||||
"LicenseContext": "NonCommercial"
|
"EPPlus": {
|
||||||
}
|
"ExcelPackage": {
|
||||||
},
|
"LicenseContext": "NonCommercial"
|
||||||
"MinIO": {
|
}
|
||||||
"Endpoint": "https://s3.frappet.com/",
|
},
|
||||||
"AccessKey": "frappet",
|
"MinIO": {
|
||||||
"SecretKey": "P@ssw0rd",
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
"BucketName": "bma-recruit"
|
"AccessKey": "frappet",
|
||||||
},
|
"SecretKey": "P@ssw0rd",
|
||||||
"Protocol": "HTTPS",
|
"BucketName": "bma-recruit"
|
||||||
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
},
|
||||||
"APIV2": "https://bma-ehr.frappet.synology.me/api/v2",
|
"Protocol": "HTTPS",
|
||||||
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
||||||
|
"APIV2": "https://bma-ehr.frappet.synology.me/api/v2",
|
||||||
|
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue