This commit is contained in:
parent
dc2603d107
commit
25f6ebcdd7
2 changed files with 104 additions and 5 deletions
|
|
@ -1253,6 +1253,104 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี NEW
|
||||||
|
public async Task<dynamic> GetEvaluationResult5YearReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||||
|
{
|
||||||
|
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (period == null)
|
||||||
|
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||||
|
|
||||||
|
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||||
|
.Where(x => x.Request.Period.Id == period.Id)
|
||||||
|
.Where(x => x.IsApprove == true)
|
||||||
|
.Where(x => x.Status == "PENDING")
|
||||||
|
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||||
|
|
||||||
|
if (type == "officer")
|
||||||
|
{
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||||
|
}
|
||||||
|
else if (type == "employee")
|
||||||
|
{
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (node)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var data = await data_insigniaQuery
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
|
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||||
|
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||||
|
Reason = x.Reason,
|
||||||
|
Agency = x.Root,
|
||||||
|
ResultAPR1 = x.APR1,
|
||||||
|
ResultOCT1 = x.OCT1,
|
||||||
|
ResultAPR2 = x.APR2,
|
||||||
|
ResultOCT2 = x.OCT2,
|
||||||
|
ResultAPR3 = x.APR3,
|
||||||
|
ResultOCT3 = x.OCT3,
|
||||||
|
ResultAPR4 = x.APR4,
|
||||||
|
ResultOCT4 = x.OCT4,
|
||||||
|
ResultAPR5 = x.APR5,
|
||||||
|
ResultOCT5 = x.OCT5
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
var resultList = new List<object>();
|
||||||
|
foreach (var d in data)
|
||||||
|
{
|
||||||
|
resultList.Add(new
|
||||||
|
{
|
||||||
|
rowNo = seq++.ToString().ToThaiNumber(),
|
||||||
|
d.ProfileId,
|
||||||
|
d.FullName,
|
||||||
|
d.RequestInsigniaName,
|
||||||
|
Agency = d.Agency,
|
||||||
|
ResultAPR1 = d.ResultAPR1 ?? "-",
|
||||||
|
ResultOCT1 = d.ResultOCT1 ?? "-",
|
||||||
|
ResultAPR2 = d.ResultAPR2 ?? "-",
|
||||||
|
ResultOCT2 = d.ResultOCT2 ?? "-",
|
||||||
|
ResultAPR3 = d.ResultAPR3 ?? "-",
|
||||||
|
ResultOCT3 = d.ResultOCT3 ?? "-",
|
||||||
|
ResultAPR4 = d.ResultAPR4 ?? "-",
|
||||||
|
ResultOCT4 = d.ResultOCT4 ?? "-",
|
||||||
|
ResultAPR5 = d.ResultAPR5 ?? "-",
|
||||||
|
ResultOCT5 = d.ResultOCT5 ?? "-",
|
||||||
|
Remark = d.Reason ?? "-"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
//noti ยื่นเสนอคน
|
//noti ยื่นเสนอคน
|
||||||
public async Task NotifyInsignia()
|
public async Task NotifyInsignia()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using BMA.EHR.Domain.Models.Insignias;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
using BMA.EHR.Insignia.Service.Requests;
|
using BMA.EHR.Insignia.Service.Requests;
|
||||||
|
using Elasticsearch.Net;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
@ -223,6 +224,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
[HttpPost("report2/{type}")]
|
[HttpPost("report2/{type}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetInsigniaReport2Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
|
public async Task<ActionResult<ResponseObject>> GetInsigniaReport2Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
|
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
|
||||||
|
|
@ -232,18 +234,17 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
|
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
|
||||||
var agency = "";
|
|
||||||
|
|
||||||
var data = await _repository.GetEvaluationResultReport(req.roundId, type, req.node, req.nodeId);
|
var data = await _repository.GetEvaluationResult5YearReport(req.roundId, type, req.node, req.nodeId);
|
||||||
var year = ((DateTime.UtcNow.Year) + 543);
|
var year = ((DateTime.UtcNow.Year) + 543);
|
||||||
|
var _agency = data.Count > 0 ? data[0].GetType().GetProperty("Agency").GetValue(data[0]) : null;
|
||||||
var result = new
|
var result = new
|
||||||
{
|
{
|
||||||
template = "reportInsignia2",
|
template = "reportInsignia2",
|
||||||
reportName = "reportInsignia2",
|
reportName = "reportInsignia2",
|
||||||
data = new
|
data = new
|
||||||
{
|
{
|
||||||
agency = agency,
|
agency = _agency,
|
||||||
yearInsignalPeriod = yearInsignalPeriod,
|
yearInsignalPeriod = yearInsignalPeriod,
|
||||||
year1 = year.ToString().ToThaiNumber(),
|
year1 = year.ToString().ToThaiNumber(),
|
||||||
year2 = (year - 1).ToString().ToThaiNumber(),
|
year2 = (year - 1).ToString().ToThaiNumber(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue