เครื่องราชเช็คตามรายการ
This commit is contained in:
parent
2efc1910f6
commit
a951378b1f
21 changed files with 57711 additions and 61 deletions
|
|
@ -7476,7 +7476,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
//.ThenInclude(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Period.Id == period.Id && x.OrganizationId == ocId);
|
||||
|
||||
var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
//var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
|
||||
return new InsigniaResults
|
||||
{
|
||||
|
|
@ -7488,7 +7488,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
RequestId = request == null ? null : request.Id,
|
||||
RequestNote = request == null ? "" : request.RequestNote,
|
||||
RequestStatus = request == null ? null : request.RequestStatus,
|
||||
OrganizationName = request == null ? "" : oc.Root,
|
||||
OrganizationName = request == null ? "" : request.Organization,
|
||||
Document = request == null
|
||||
? null
|
||||
: (request.Document == null
|
||||
|
|
@ -7759,7 +7759,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
// }
|
||||
|
||||
// insert candidate list
|
||||
public async Task InsertCandidate(Guid periodId, Guid ocId, List<InsigniaResultSet> items)
|
||||
public async Task InsertCandidate(Guid periodId, Guid ocId, string oc, List<InsigniaResultSet> items)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -7782,7 +7782,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
|
||||
//var oc = await _dbContext.Set<OrganizationEntity>().FirstOrDefaultAsync(x => x.Id == ocId);
|
||||
var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
//var oc = _userProfileRepository.GetOc(ocId, 0, AccessToken);
|
||||
|
||||
//if (oc == null)
|
||||
// throw new Exception(GlobalMessages.OCNotFound);
|
||||
|
|
@ -7790,7 +7790,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
var req = new InsigniaRequest
|
||||
{
|
||||
Period = period,
|
||||
OrganizationId = oc!.RootId!.Value,
|
||||
OrganizationId = ocId,
|
||||
Organization = oc,
|
||||
RequestStatus = "st1",
|
||||
RequestNote = "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Metadata;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -1104,10 +1105,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
{
|
||||
if (insigniaPeriod.StartDate == DateTime.Now.Date)
|
||||
continue;
|
||||
var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
if (organizationType == null)
|
||||
continue;
|
||||
var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
//if (organizationType == null)
|
||||
// continue;
|
||||
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||
Console.WriteLine(JsonConvert.SerializeObject(organizations));
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
|
|
@ -1123,7 +1126,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repositoryInsignia.InsertCandidate(period, organization.Id, candidate);
|
||||
await _repositoryInsignia.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -601,7 +601,28 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<GetActiveRootDto>> GetActiveRootLatestAsync(string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/active/root/all";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetActiveRootResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task PostProfileInsigniaAsync(PostProfileInsigniaDto body, string? accessToken)
|
||||
{
|
||||
|
|
@ -622,6 +643,28 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
}
|
||||
|
||||
public async Task<GetIsOfficerDto> GetIsOfficerRootAsync(string? accessToken, string sys)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/workflow/keycloak/isofficer-root/{sys}";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetIsOfficerResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
return new GetIsOfficerDto { isOfficer = false, isStaff = false, isDirector = false };
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
namespace BMA.EHR.Application.Responses.Organizations
|
||||
{
|
||||
public class GetIsOfficerDto
|
||||
{
|
||||
public bool isOfficer { get; set; }
|
||||
public bool isStaff { get; set; }
|
||||
public bool isDirector { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.Application.Responses.Organizations
|
||||
{
|
||||
public class GetIsOfficerResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public GetIsOfficerDto Result { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ namespace BMA.EHR.Domain.Models.Insignias
|
|||
|
||||
//public OrganizationEntity Organization { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public string? Organization { get; set; }
|
||||
|
||||
public Document? Document { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public string? RejectReason { get; set; }
|
||||
[Comment("เหตุผลยกเลิก")]
|
||||
public string? CancelReason { get; set; }
|
||||
[Comment("สถานะยกเลิก")]
|
||||
public bool IsCancel { get; set; } = false;
|
||||
[Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
[Comment("สถานะไม่เป็นหนี้สหกรณ์")]
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public string? RejectReason { get; set; }
|
||||
[Comment("เหตุผลยกเลิก")]
|
||||
public string? CancelReason { get; set; }
|
||||
[Comment("สถานะยกเลิก")]
|
||||
public bool IsCancel { get; set; } = false;
|
||||
[Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
[Comment("สถานะไม่เป็นหนี้สหกรณ์")]
|
||||
|
|
|
|||
|
|
@ -70,9 +70,6 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
|
||||
#region " Properties "
|
||||
|
||||
private bool? RoleAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("admin");
|
||||
private bool? RoleInsignia1 => _httpContextAccessor?.HttpContext?.User?.IsInRole("insignia1");
|
||||
private bool? RoleInsignia2 => _httpContextAccessor?.HttpContext?.User?.IsInRole("insignia2");
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
|
@ -113,7 +110,7 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await insigniaRepo.InsertCandidate(period, organization.Id, candidate);
|
||||
await insigniaRepo.InsertCandidate(period, organization.Id,organization.OrgRootName, candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
19149
BMA.EHR.Infrastructure/Migrations/20241113071721_update table InsigniaRequest add org.Designer.cs
generated
Normal file
19149
BMA.EHR.Infrastructure/Migrations/20241113071721_update table InsigniaRequest add org.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,29 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableInsigniaRequestaddorg : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Organization",
|
||||
table: "InsigniaRequests",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Organization",
|
||||
table: "InsigniaRequests");
|
||||
}
|
||||
}
|
||||
}
|
||||
19152
BMA.EHR.Infrastructure/Migrations/20241113092721_update table InsigniaRequest add org2.Designer.cs
generated
Normal file
19152
BMA.EHR.Infrastructure/Migrations/20241113092721_update table InsigniaRequest add org2.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,58 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableInsigniaRequestaddorg2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsCancel",
|
||||
table: "RetirementResignEmployees",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
comment: "สถานะยกเลิก");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Organization",
|
||||
table: "InsigniaRequests",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsCancel",
|
||||
table: "RetirementResignEmployees");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "InsigniaRequests",
|
||||
keyColumn: "Organization",
|
||||
keyValue: null,
|
||||
column: "Organization",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Organization",
|
||||
table: "InsigniaRequests",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
19156
BMA.EHR.Infrastructure/Migrations/20241113095244_update table Retire add iscancel.Designer.cs
generated
Normal file
19156
BMA.EHR.Infrastructure/Migrations/20241113095244_update table Retire add iscancel.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableRetireaddiscancel : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsCancel",
|
||||
table: "RetirementResigns",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
comment: "สถานะยกเลิก");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsCancel",
|
||||
table: "RetirementResigns");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6339,6 +6339,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("Organization")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -15858,6 +15861,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
b.Property<bool>("IsCancel")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะยกเลิก");
|
||||
|
||||
b.Property<bool>("IsDiscipline")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะพฤติการณ์ทางวินัย");
|
||||
|
|
@ -16547,6 +16554,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
b.Property<bool>("IsCancel")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะยกเลิก");
|
||||
|
||||
b.Property<bool>("IsDiscipline")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะพฤติการณ์ทางวินัย");
|
||||
|
|
|
|||
|
|
@ -442,15 +442,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpGet("org/dashboard/{insigniaManageId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetListDashboardOrganization(Guid insigniaManageId)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(insigniaManageId.ToString(), "SYS_INSIGNIA_ALLOCATE");
|
||||
if (getWorkflow == false)
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_ALLOCATE");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_ALLOCATE");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.Include(x => x.InsigniaManageOrganiations)
|
||||
|
|
|
|||
|
|
@ -145,15 +145,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpGet("{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetById(Guid id)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_INSIGNIA_ROUND");
|
||||
if (getWorkflow == false)
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_ROUND");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_ROUND");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var data = await _context.InsigniaPeriods.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Application.Responses.Insignias;
|
||||
using BMA.EHR.Application.Responses.Organizations;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
|
|
@ -44,6 +46,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private const string INSIGNIA_QUEUE = "bma_insignia_request";
|
||||
|
||||
private readonly InsigniaPeriodsRepository _insigniaPeriodRepository;
|
||||
private readonly InsigniaReportRepository _insigniaReportRepository;
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly PermissionRepository _permission;
|
||||
/// <summary>
|
||||
|
|
@ -66,6 +70,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository,
|
||||
InsigniaPeriodsRepository insigniaPeriodRepository,
|
||||
InsigniaReportRepository insigniaReportRepository,
|
||||
IConfiguration configuration,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
|
|
@ -79,17 +84,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
_insigniaPeriodRepository = insigniaPeriodRepository;
|
||||
_configuration = configuration;
|
||||
_permission = permission;
|
||||
_insigniaReportRepository = insigniaReportRepository;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private bool? RoleAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("admin");
|
||||
private bool? RoleInsignia1 => _httpContextAccessor?.HttpContext?.User?.IsInRole("insignia1");
|
||||
private bool? RoleInsignia2 => _httpContextAccessor?.HttpContext?.User?.IsInRole("insignia2");
|
||||
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
|
@ -347,12 +348,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkk(Guid insigniaPeriodId, Guid ocId, string role, string status)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_MANAGE");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
// var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_MANAGE");
|
||||
// var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// if (jsonData["status"]?.ToString() != "200")
|
||||
// {
|
||||
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// }
|
||||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId);
|
||||
if (result != null)
|
||||
{
|
||||
|
|
@ -376,9 +377,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Document = result.Document,
|
||||
Items = new List<InsigniaRequestItem>()
|
||||
};
|
||||
if (RoleAdmin == true && result.RequestStatus != "st6")
|
||||
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "INSIGNIA");
|
||||
if (RoleInsignia.isOfficer == true && result.RequestStatus != "st6")
|
||||
return Success(resend);
|
||||
if (RoleInsignia2 == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2"))
|
||||
if (RoleInsignia.isDirector == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2"))
|
||||
return Success(resend);
|
||||
|
||||
// Jack Remark Remove เพื่อให้เรียกขข้อมูลออกมาเร็สวขึ้น
|
||||
|
|
@ -594,7 +596,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repository.InsertCandidate(period, organization.Id, candidate);
|
||||
await _repository.InsertCandidate(period, organization.Id,organization.OrgRootName, candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -962,25 +964,22 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpGet("dashboard/{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> DashboardInsigniaPeriod(Guid insigniaPeriodId)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(insigniaPeriodId.ToString(), "SYS_INSIGNIA_MANAGE");
|
||||
if (getWorkflow == false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_MANAGE");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
}
|
||||
// var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_MANAGE");
|
||||
// var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// if (jsonData["status"]?.ToString() != "200")
|
||||
// {
|
||||
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// }
|
||||
var insigniaPeriod = await _context.InsigniaPeriods.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
|
||||
if (insigniaPeriod == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var orgAllCount = await _context.InsigniaRequests
|
||||
.Where(x => x.Period == insigniaPeriod)
|
||||
.ToListAsync();
|
||||
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "INSIGNIA");
|
||||
var allUserUser = await _context.InsigniaRequests
|
||||
.Where(x => x.Period == insigniaPeriod)
|
||||
.Where(x => RoleAdmin == true ? x.RequestStatus == "st6" : (RoleInsignia2 == true ? (x.RequestStatus != "st1" && x.RequestStatus != "st2") : x.Id != null))
|
||||
.Where(x => RoleInsignia.isOfficer == true ? x.RequestStatus == "st6" : (RoleInsignia.isDirector == true ? (x.RequestStatus != "st1" && x.RequestStatus != "st2") : x.Id != null))
|
||||
.Select(x => x.RequestProfiles.Count(x => x.Status != "DELETE" && x.Status != "REJECT"))
|
||||
.SumAsync();
|
||||
|
||||
|
|
@ -1040,6 +1039,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpGet("agency")]
|
||||
public async Task<ActionResult<ResponseObject>> GetOrgAgency()
|
||||
{
|
||||
await _insigniaReportRepository.CalInsignaiRequestBkk();
|
||||
//var profile = await _context.Profiles.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.KeycloakId == (UserId != null && UserId != "" ? Guid.Parse(UserId) : Guid.Parse("00000000-0000-0000-0000-000000000000")));
|
||||
//if (profile == null)
|
||||
|
|
|
|||
|
|
@ -327,13 +327,13 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Status,
|
||||
p.IsCancel,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (dataMain == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
if (dataMain.Status != "CANCEL")
|
||||
if (dataMain.IsCancel != true)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_RESIGN");
|
||||
var createdUserId = await _context.RetirementResigns.AsQueryable()
|
||||
|
|
@ -503,6 +503,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CancelReason,
|
||||
idCancel = data.RetirementResignCancels?.Id ?? Guid.Empty,
|
||||
statusCancel = data.RetirementResignCancels?.Status ?? null,
|
||||
statusMain = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
|
|
@ -512,7 +513,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
|
||||
var createdUserId = await _context.RetirementResignCancels.AsQueryable()
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
|
|
@ -669,6 +669,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CancelReason,
|
||||
data.idMain,
|
||||
data.statusMain,
|
||||
statusCancel = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
|
|
@ -1242,6 +1243,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posTypeName = retirementResignCancel.PositionTypeOld,
|
||||
});
|
||||
}
|
||||
updated.IsCancel = true;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
|
|
|||
|
|
@ -271,13 +271,13 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Status,
|
||||
p.IsCancel,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (dataMain == null)
|
||||
return Error(GlobalMessages.RetirementResignEmployeeNotFound, 404);
|
||||
|
||||
if (dataMain.Status != "CANCEL")
|
||||
if (dataMain.IsCancel != true)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_RESIGN");
|
||||
var createdUserId = await _context.RetirementResignEmployees.AsQueryable()
|
||||
|
|
@ -447,6 +447,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CancelReason,
|
||||
idCancel = data.RetirementResignEmployeeCancels?.Id ?? Guid.Empty,
|
||||
statusCancel = data.RetirementResignEmployeeCancels?.Status ?? null,
|
||||
statusMain = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignEmployeeDocs,
|
||||
// DocDebts = retirementResignEmployeeDebtDocs,
|
||||
|
|
@ -456,7 +457,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
|
||||
var createdUserId = await _context.RetirementResignEmployeeCancels.AsQueryable()
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
|
|
@ -613,6 +613,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CancelReason,
|
||||
data.idMain,
|
||||
data.statusMain,
|
||||
statusCancel = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignEmployeeDocs,
|
||||
// DocDebts = retirementResignEmployeeDebtDocs,
|
||||
|
|
@ -1186,6 +1187,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posTypeName = retirementResignEmployeeCancel.PositionTypeOld,
|
||||
});
|
||||
}
|
||||
updated.IsCancel = true;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue