แก้ list พ้น

This commit is contained in:
kittapath 2024-11-14 18:04:20 +07:00
parent bebd9620a5
commit 817f7a91ac
8 changed files with 92 additions and 77 deletions

View file

@ -73,18 +73,18 @@ jobs:
- uses: snow-actions/line-notify@v1.1.0
if: success()
with:
access_token: ${{ secrets.TOKEN_LINE }}
message: |
-Success✅✅✅
Image: ${{env.IMAGE_NAME}}
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
access_token: ${{ env.TOKEN_LINE }}
message: |
-Success✅✅✅
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0
if: failure()
with:
access_token: ${{ secrets.TOKEN_LINE }}
message: |
-Failure❌❌❌
Image: ${{env.IMAGE_NAME}}
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
access_token: ${{ env.TOKEN_LINE }}
message: |
-Failure❌❌❌
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}

View file

@ -994,12 +994,12 @@ namespace BMA.EHR.Application.Repositories.Reports
{
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
.AsQueryable()
.Include(x => x.InsigniaRequests)
.Include(x => x.ReliefDoc)
.Include(x => x.InsigniaRequests)
.Include(x => x.ReliefDoc)
.ToListAsync();
foreach (var insigniaPeriod in insigniaPeriods)
{
if (insigniaPeriod.EndDate.Date.AddDays(5) < DateTime.Now.Date)
if (insigniaPeriod.EndDate.Date.AddDays(5) > DateTime.Now.Date)
continue;
insigniaPeriod.IsLock = true;
var insigniaNote = await _dbContext.Set<InsigniaNote>()
@ -1103,14 +1103,15 @@ namespace BMA.EHR.Application.Repositories.Reports
.ToListAsync();
foreach (var insigniaPeriod in insigniaPeriods)
{
if (insigniaPeriod.StartDate == DateTime.Now.Date)
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 organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
Console.WriteLine(JsonConvert.SerializeObject(organizations));
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(null);
if(organizations == null)
continue;
foreach (var organization in organizations)
{
if (organization == null)

View file

@ -377,7 +377,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
Document = result.Document,
Items = new List<InsigniaRequestItem>()
};
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "INSIGNIA");
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE");
if (RoleInsignia.isOfficer == true && result.RequestStatus != "st6")
return Success(resend);
if (RoleInsignia.isDirector == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2"))
@ -976,7 +976,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
var orgAllCount = await _context.InsigniaRequests
.Where(x => x.Period == insigniaPeriod)
.ToListAsync();
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "INSIGNIA");
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE");
var allUserUser = await _context.InsigniaRequests
.Where(x => x.Period == insigniaPeriod)
.Where(x => RoleInsignia.isOfficer == true ? x.RequestStatus == "st6" : (RoleInsignia.isDirector == true ? (x.RequestStatus != "st1" && x.RequestStatus != "st2") : x.Id != null))

View file

@ -525,7 +525,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
uppdated.root = org.result.root;
uppdated.rootId = org.result.rootId;
uppdated.rootShortName = org.result.rootShortName;
@ -543,6 +542,18 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = req.profileId,
});
}
uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node;

View file

@ -574,6 +574,18 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/employee/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = req.profileId,
});
}
uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node;

View file

@ -884,6 +884,18 @@ namespace BMA.EHR.Placement.Service.Controllers
person.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterId = req.posmasterId,
profileId = req.profileId,
});
}
person.Draft = false;
person.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
person.ReportingDate = req.reportingDate;
@ -1254,6 +1266,16 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master/clear";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterId = profile.posmasterId,
});
}
profile.root = null;
profile.rootId = null;
profile.rootShortName = null;

View file

@ -643,6 +643,18 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = req.profileId,
});
}
uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node;
uppdated.nodeId = req.nodeId;

View file

@ -81,39 +81,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetList()
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_PASSAWAY");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_PASSAWAY", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var rootId = "";
var child1Id = "";
var child2Id = "";
var child3Id = "";
var child4Id = "";
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
rootId = org.result.rootId == null ? "" : org.result.rootId;
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
var retirementDeceaseds = await _context.RetirementDeceaseds.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id)))))
string?[] rootId = jsonData?.result?.rootId ?? null;
string?[] child1Id = jsonData?.result?.child1Id ?? null;
string?[] child2Id = jsonData?.result?.child2Id ?? null;
string?[] child3Id = jsonData?.result?.child3Id ?? null;
string?[] child4Id = jsonData?.result?.child4Id ?? null;
var retirementDeceaseds = await _context.RetirementDeceaseds.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == null ? true : rootId.Contains(x.rootId))
.Where(x => child1Id == null ? true : child1Id.Contains(x.child1Id))
.Where(x => child2Id == null ? true : child2Id.Contains(x.child2Id))
.Where(x => child3Id == null ? true : child3Id.Contains(x.child3Id))
.Where(x => child4Id == null ? true : child4Id.Contains(x.child4Id))
.Select(p => new
{
p.Id,
@ -140,36 +126,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.IsActive,
})
.ToListAsync();
// var _retirementDeceaseds = new List<dynamic>();
// foreach (var data in retirementDeceaseds)
// {
// var _data = new
// {
// data.Id,
// data.ProfileId,
// data.Prefix,
// data.FirstName,
// data.LastName,
// data.Position,
// data.PositionExecutive,
// data.PositionType,
// data.PositionLine,
// data.PositionLevel,
// data.Organization,
// data.Number,
// data.Date,
// data.Location,
// data.Reason,
// data.FileName,
// PathName = data.PathName == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.PathName),
// data.IsActive,
// data.CreatedAt,
// };
// _retirementDeceaseds.Add(_data);
// }
return Success(retirementDeceaseds);
}
}
/// <summary>