fix Issue
This commit is contained in:
parent
400ed73809
commit
b041933e5c
2 changed files with 24 additions and 5 deletions
|
|
@ -253,6 +253,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||||
.Where(x => x.Type.Id == leaveType.Id)
|
.Where(x => x.Type.Id == leaveType.Id)
|
||||||
.Where(x => x.LeaveStartDate.Year == year)
|
.Where(x => x.LeaveStartDate.Year == year)
|
||||||
|
.Where(x => x.LeaveStatus == "APPROVE")
|
||||||
.Sum(x => x.LeaveTotal);
|
.Sum(x => x.LeaveTotal);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
@ -265,7 +266,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||||
.Where(x => x.Type.Id == leaveTypeId)
|
.Where(x => x.Type.Id == leaveTypeId)
|
||||||
.Where(x => x.LeaveStartDate.Year == year)
|
.Where(x => x.LeaveStartDate.Year == year)
|
||||||
.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
.Where(x => x.LeaveStatus == "APPROVE")
|
||||||
|
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return data.Sum(x => x.LeaveTotal);
|
return data.Sum(x => x.LeaveTotal);
|
||||||
|
|
@ -290,7 +292,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
.Include(x => x.Type)
|
.Include(x => x.Type)
|
||||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||||
.Where(x => x.Type.Id == leaveTypeId)
|
.Where(x => x.Type.Id == leaveTypeId)
|
||||||
.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
.Where(x => x.LeaveStatus == "APPROVE")
|
||||||
|
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||||
.OrderByDescending(x => x.LeaveStartDate.Date)
|
.OrderByDescending(x => x.LeaveStartDate.Date)
|
||||||
.Select(x => x.LeaveStartDate.Date)
|
.Select(x => x.LeaveStartDate.Date)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
@ -304,7 +307,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
.Include(x => x.Type)
|
.Include(x => x.Type)
|
||||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||||
.Where(x => x.Type.Id == leaveTypeId)
|
.Where(x => x.Type.Id == leaveTypeId)
|
||||||
.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
.Where(x => x.LeaveStatus == "APPROVE")
|
||||||
|
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||||
.OrderByDescending(x => x.LeaveStartDate.Date)
|
.OrderByDescending(x => x.LeaveStartDate.Date)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
using BMA.EHR.Application.Repositories.Commands;
|
using BMA.EHR.Application.Repositories.Commands;
|
||||||
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
|
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
|
||||||
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
|
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
|
||||||
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Application.Responses.Profiles;
|
using BMA.EHR.Application.Responses.Profiles;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||||
|
|
@ -54,6 +55,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
private readonly CommandRepository _commandRepository;
|
private readonly CommandRepository _commandRepository;
|
||||||
|
|
||||||
|
private readonly NotificationRepository _notificationRepository;
|
||||||
|
|
||||||
private readonly string _bucketName = "check-in";
|
private readonly string _bucketName = "check-in";
|
||||||
|
|
||||||
private readonly ObjectPool<IModel> _objectPool;
|
private readonly ObjectPool<IModel> _objectPool;
|
||||||
|
|
@ -79,7 +82,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
CommandRepository commandRepository,
|
CommandRepository commandRepository,
|
||||||
LeaveRequestRepository leaveRequestRepository,
|
LeaveRequestRepository leaveRequestRepository,
|
||||||
ObjectPool<IModel> objectPool,
|
ObjectPool<IModel> objectPool,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
NotificationRepository notificationRepository)
|
||||||
{
|
{
|
||||||
_dutyTimeRepository = dutyTimeRepository;
|
_dutyTimeRepository = dutyTimeRepository;
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
@ -95,6 +99,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
_userCalendarRepository = userCalendarRepository;
|
_userCalendarRepository = userCalendarRepository;
|
||||||
_commandRepository = commandRepository;
|
_commandRepository = commandRepository;
|
||||||
_leaveRequestRepository = leaveRequestRepository;
|
_leaveRequestRepository = leaveRequestRepository;
|
||||||
|
_notificationRepository = notificationRepository;
|
||||||
|
|
||||||
_objectPool = objectPool;
|
_objectPool = objectPool;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
|
@ -1716,9 +1721,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
// change user timestamp
|
// change user timestamp
|
||||||
var processTimeStamp = await _processUserTimeStampRepository.GetTimestampByDateAsync(requestData.KeycloakUserId, requestData.CheckDate.Date);
|
var processTimeStamp = await _processUserTimeStampRepository.GetTimestampByDateAsync(requestData.KeycloakUserId, requestData.CheckDate.Date);
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(requestData.KeycloakUserId, AccessToken);
|
||||||
|
|
||||||
if (processTimeStamp == null)
|
if (processTimeStamp == null)
|
||||||
{
|
{
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(requestData.KeycloakUserId, AccessToken);
|
|
||||||
|
|
||||||
processTimeStamp = new ProcessUserTimeStamp
|
processTimeStamp = new ProcessUserTimeStamp
|
||||||
{
|
{
|
||||||
|
|
@ -1777,6 +1784,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
await _processUserTimeStampRepository.UpdateAsync(processTimeStamp);
|
await _processUserTimeStampRepository.UpdateAsync(processTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var recvId = new List<Guid> { profile.Id };
|
||||||
|
await _notificationRepository.PushNotificationsAsync(recvId.ToArray(), "ลงเวลากรณีพิเศษ", "การขอลงเวลากรณีพิเศษของคุณได้รับการอนุมัติ", "", "", true, false);
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1826,6 +1836,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
requestData.Comment = req.Reason;
|
requestData.Comment = req.Reason;
|
||||||
await _additionalCheckRequestRepository.UpdateAsync(requestData);
|
await _additionalCheckRequestRepository.UpdateAsync(requestData);
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(requestData.KeycloakUserId, AccessToken);
|
||||||
|
|
||||||
|
var recvId = new List<Guid> { profile.Id };
|
||||||
|
await _notificationRepository.PushNotificationsAsync(recvId.ToArray(), "ลงเวลากรณีพิเศษ", "การขอลงเวลากรณีพิเศษของคุณไม่ได้รับการอนุมัติ", "", "", true, false);
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue