api ปฏิเสธจ่ายเงิน get ไฟล์สมัครสอบ

This commit is contained in:
Kittapath 2023-04-09 04:22:04 +07:00
parent 9486ad160d
commit 5abeada4a6
32 changed files with 7513 additions and 394 deletions

View file

@ -414,7 +414,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return await _context.CandidateDocuments.AsQueryable()
var document = await _context.CandidateDocuments.AsQueryable()
.Where(x => x.Candidate == candidate)
.Select(x => new FileListResponse
{
@ -422,8 +422,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
FileName = x.Document == null ? "" : x.Document.FileName,
FileType = x.Document == null ? "" : x.Document.FileType,
FileSize = x.Document == null ? 0 : x.Document.FileSize,
Detail = x.Document == null ? "" : x.Document.Id.ToString(),
})
.ToListAsync();
var i = 0;
foreach (var item in document)
{
if (document[i].Detail != null && document[i].Detail != "")
document[i].Detail = _minioService.ImagesPath(Guid.Parse(document[i].Detail)).Result;
i++;
}
return document;
}
public async Task<string> GetsAsyncProfileImage(string examId, string positionId)
@ -456,10 +467,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.ProfileImg == null ? "" : candidate.ProfileImg.Id.ToString();
if (candidate.ProfileImg != null)
candidate.ProfileImg.Detail = _minioService.ImagesPath(candidate.ProfileImg.Id).Result;
return candidate.ProfileImg == null ? "" : candidate.ProfileImg.Detail;
}
public async Task<string> GetsAsyncPaymentImg(string examId, string positionId)
public async Task<PaymentImgResponse> GetsAsyncPaymentImg(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -489,7 +503,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
if (candidate.PaymentImg != null)
candidate.PaymentImg.Detail = _minioService.ImagesPath(candidate.PaymentImg.Id).Result;
return new PaymentImgResponse { PaymentImg = candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail, RejectDetail = candidate.RejectDetail };
}
public async Task<string> GetsAsyncPaymentImgCandidate(string candidateId)
@ -502,7 +519,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
if (candidate.PaymentImg != null)
candidate.PaymentImg.Detail = _minioService.ImagesPath(candidate.PaymentImg.Id).Result;
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail.ToString();
}
public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(string examId, string positionId)
@ -873,7 +893,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.ProfileImg != null)
{
await DeleteAsyncDocument(candidate.ProfileImg.Id.ToString());
await DeleteDocument(candidate.ProfileImg.Id.ToString());
}
var doc = await _minioService.UploadFileAsync(file);
@ -1078,11 +1098,28 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task DeleteAsyncDocument(string documentId)
public async Task DeleteDocument(string documentId)
{
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
}
public async Task DeleteAsyncDocument(string examId, string positionId, string documentId)
{
var exam = await _context.PeriodExams.AsQueryable()
.Include(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var position = exam.PositionExam.Where(x => x.Id == Guid.Parse(positionId)).FirstOrDefault();
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
}
public async Task CreateAsyncCareer(string examId, string positionId, CandidateCareerResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId, positionId);
@ -1219,7 +1256,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task<string> GetStatusCandidateService(string examId, string positionId)
public async Task<CandidateStatusResponse> GetStatusCandidateService(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -1245,7 +1282,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.Status;
return new CandidateStatusResponse { Status = candidate.Status, RejectDetail = candidate.RejectDetail };
}
public async Task UserCheckCandidateService(string examId, string positionId, string status)
@ -1358,7 +1395,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.PaymentImg != null)
{
await DeleteAsyncDocument(candidate.PaymentImg.Id.ToString());
await DeleteDocument(candidate.PaymentImg.Id.ToString());
}
var doc = await _minioService.UploadFileAsync(file);