คิวรี่ชื่อสังกัด เกษียณ
This commit is contained in:
parent
978e1bada1
commit
3328bdf726
2 changed files with 130 additions and 19 deletions
|
|
@ -26,6 +26,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
|
|
@ -34,12 +35,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IConfiguration configuration,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
|
@ -277,10 +280,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(GlobalMessages.RetirementNotCreated);
|
||||
if (req.Option == null)
|
||||
req.Option = "EDIT";
|
||||
var file_name = $"retire_tmp_{DateTime.Now.ToString("yyyyMMddTHHmmss")}";
|
||||
var profile_old = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod == retire)
|
||||
.Select(x => new ProfileJsonRequest
|
||||
.Select(x => new
|
||||
{
|
||||
order = x.Order,
|
||||
id = x.Id,
|
||||
|
|
@ -291,7 +293,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
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,
|
||||
ocId = x.Profile.OcId,
|
||||
position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||
positionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name,
|
||||
positionExecutive = x.Profile.PositionExecutive,
|
||||
|
|
@ -302,7 +304,34 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(profile_old);
|
||||
var file_name = $"retire_tmp_{DateTime.Now.ToString("yyyyMMddTHHmmss")}";
|
||||
var profile_olds = new List<ProfileJsonRequest>();
|
||||
foreach (var r in profile_old)
|
||||
{
|
||||
var data = new ProfileJsonRequest
|
||||
{
|
||||
order = r.order,
|
||||
id = r.id,
|
||||
reason = r.reason,
|
||||
remove = r.remove,
|
||||
profileId = r.profileId,
|
||||
citizenId = r.citizenId,
|
||||
prefix = r.prefix,
|
||||
fullName = r.fullName,
|
||||
organizationOrganization = r.organizationOrganization,
|
||||
oc = r.ocId == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(r.ocId.Value),
|
||||
position = r.position,
|
||||
positionType = r.positionType,
|
||||
positionExecutive = r.positionExecutive,
|
||||
posNo = r.posNo,
|
||||
positionEmployeePosition = r.positionEmployeePosition,
|
||||
positionEmployeeLevel = r.positionEmployeeLevel,
|
||||
positionEmployeeGroup = r.positionEmployeeGroup,
|
||||
posNoEmployee = r.posNoEmployee,
|
||||
};
|
||||
profile_olds.Add(data);
|
||||
}
|
||||
var profile = Newtonsoft.Json.JsonConvert.SerializeObject(profile_olds);
|
||||
await _documentService.GenerateJsonFile(profile, "/retire", file_name);
|
||||
var history = new RetirementPeriodHistory
|
||||
{
|
||||
|
|
@ -411,7 +440,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
// await _context.SaveChangesAsync();
|
||||
var profile_new = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod == retire)
|
||||
.Select(x => new ProfileJsonRequest
|
||||
.Select(x => new
|
||||
{
|
||||
order = x.Order,
|
||||
id = x.Id,
|
||||
|
|
@ -422,7 +451,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
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,
|
||||
ocId = x.Profile.OcId,
|
||||
position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||
positionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name,
|
||||
positionExecutive = x.Profile.PositionExecutive,
|
||||
|
|
@ -433,7 +462,33 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
return Success(new { retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_new });
|
||||
var profile_news = new List<ProfileJsonRequest>();
|
||||
foreach (var r in profile_new)
|
||||
{
|
||||
var data = new ProfileJsonRequest
|
||||
{
|
||||
order = r.order,
|
||||
id = r.id,
|
||||
reason = r.reason,
|
||||
remove = r.remove,
|
||||
profileId = r.profileId,
|
||||
citizenId = r.citizenId,
|
||||
prefix = r.prefix,
|
||||
fullName = r.fullName,
|
||||
organizationOrganization = r.organizationOrganization,
|
||||
oc = r.ocId == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(r.ocId.Value),
|
||||
position = r.position,
|
||||
positionType = r.positionType,
|
||||
positionExecutive = r.positionExecutive,
|
||||
posNo = r.posNo,
|
||||
positionEmployeePosition = r.positionEmployeePosition,
|
||||
positionEmployeeLevel = r.positionEmployeeLevel,
|
||||
positionEmployeeGroup = r.positionEmployeeGroup,
|
||||
posNoEmployee = r.posNoEmployee,
|
||||
};
|
||||
profile_news.Add(data);
|
||||
}
|
||||
return Success(new { retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_news });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -473,7 +528,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
var profile_new = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod == retire)
|
||||
.Select(x => new ProfileJsonRequest
|
||||
.Select(x => new
|
||||
{
|
||||
order = x.Order,
|
||||
id = x.Id,
|
||||
|
|
@ -484,7 +539,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
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,
|
||||
ocId = x.Profile.OcId,
|
||||
position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||
positionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name,
|
||||
positionExecutive = x.Profile.PositionExecutive,
|
||||
|
|
@ -495,8 +550,35 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
var profile_news = new List<ProfileJsonRequest>();
|
||||
foreach (var r in profile_new)
|
||||
{
|
||||
var data = new ProfileJsonRequest
|
||||
{
|
||||
order = r.order,
|
||||
id = r.id,
|
||||
reason = r.reason,
|
||||
remove = r.remove,
|
||||
profileId = r.profileId,
|
||||
citizenId = r.citizenId,
|
||||
prefix = r.prefix,
|
||||
fullName = r.fullName,
|
||||
organizationOrganization = r.organizationOrganization,
|
||||
oc = r.ocId == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(r.ocId.Value),
|
||||
position = r.position,
|
||||
positionType = r.positionType,
|
||||
positionExecutive = r.positionExecutive,
|
||||
posNo = r.posNo,
|
||||
positionEmployeePosition = r.positionEmployeePosition,
|
||||
positionEmployeeLevel = r.positionEmployeeLevel,
|
||||
positionEmployeeGroup = r.positionEmployeeGroup,
|
||||
posNoEmployee = r.posNoEmployee,
|
||||
};
|
||||
profile_news.Add(data);
|
||||
}
|
||||
|
||||
var file = retire.Document == null ? null : await _documentService.ImagesPath(retire.Document.Id);
|
||||
return Success(new { Json = false, retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_new, File = file });
|
||||
return Success(new { Json = false, retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_news, File = file });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue