แสดงรูปหลักฐานชำระ
This commit is contained in:
parent
43898213b2
commit
ab86c20b84
6 changed files with 75 additions and 8 deletions
|
|
@ -849,6 +849,42 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get id หลักฐานชำระ
|
||||
/// </summary>
|
||||
/// <param name="candidateId">รหัสผู้สมัครสอบ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อ get id หลักฐานชำระสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("payment-image/{candidateId:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsyncPaymentImgCandidate(string candidateId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = await _candidateService.GetsAsyncPaymentImgCandidate(candidateId);
|
||||
|
||||
if (doc == "")
|
||||
return Success();
|
||||
|
||||
var file_data = await _minioService.DownloadFileAsync(Guid.Parse(doc));
|
||||
Response.Headers["Content-Disposition"] = $"inline; filename={file_data.FileName}";
|
||||
var ret = new FileContentResult(file_data.FileContent, file_data.FileType)
|
||||
{
|
||||
FileDownloadName = file_data.FileName
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเอกสารหลักฐานการชำระเงิน
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -475,6 +475,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
|
||||
}
|
||||
// return Success(file);
|
||||
await _periodExamService.UploadSeatCandidateAsync(examId, file);
|
||||
|
||||
return Success();
|
||||
|
|
@ -510,6 +511,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
|
||||
}
|
||||
// return Success(file);
|
||||
await _periodExamService.UploadPointCandidateAsync(examId, file);
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
|
|||
{
|
||||
public bool Consend { get; set; }
|
||||
public bool Position { get; set; }
|
||||
public bool Bank { get; set; }
|
||||
public string? Status { get; set; }
|
||||
public PositionExam? PositionExam { get; set; }
|
||||
}
|
||||
|
|
|
|||
10
Request/testtest.cs
Normal file
10
Request/testtest.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using System.Net;
|
||||
|
||||
namespace BMA.EHR.Recurit.Exam.Service.Request
|
||||
{
|
||||
public class testtest
|
||||
{
|
||||
public CancellationToken? xxx { get; set; }
|
||||
public MemoryStream? zzz { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -492,9 +492,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
|
||||
}
|
||||
|
||||
public async Task<string> GetsAsyncPaymentImgCandidate(string candidateId)
|
||||
{
|
||||
var candidate = await _context.Candidates.AsQueryable()
|
||||
.Include(x => x.PaymentImg)
|
||||
.Where(x => x.Id == Guid.Parse(candidateId))
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (candidate == null)
|
||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||
|
||||
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
|
||||
}
|
||||
|
||||
public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(string examId, string positionId)
|
||||
{
|
||||
var exam = await _context.PeriodExams.AsQueryable()
|
||||
.Include(x => x.BankExam)
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
|
||||
|
||||
if (exam == null)
|
||||
|
|
@ -503,10 +517,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
var candidate = await _context.Candidates.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
|
||||
|
||||
var position = await _context.PositionExams.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
|
||||
|
||||
if (positionId != "00000000-0000-0000-0000-000000000000")
|
||||
{
|
||||
var position = await _context.PositionExams.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
|
||||
// var position = await _context.PositionExams.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
|
||||
|
||||
if (position == null)
|
||||
throw new Exception(GlobalMessages.PositionExamNotFound);
|
||||
|
|
@ -523,7 +540,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
Consend = candidate != null,
|
||||
Status = candidate == null ? null : candidate.Status,
|
||||
PositionExam = candidatePosition?.PositionExam,
|
||||
PositionExam = position,
|
||||
Bank = exam.BankExam.Count() > 0,
|
||||
Position = candidatePosition == null ? false : true
|
||||
};
|
||||
}
|
||||
|
|
@ -1279,9 +1297,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (candidate.PeriodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.Include(x => x.Candidate)
|
||||
.FirstOrDefaultAsync(x => x.Id == candidate.PeriodExam.Id);
|
||||
var periodExam = await _context.Candidates.AsQueryable()
|
||||
.Where(x => x.PeriodExam == candidate.PeriodExam && x.ExamIdenNumber != null)
|
||||
.ToListAsync();
|
||||
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
|
@ -1299,7 +1317,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
}
|
||||
if (candidate.Status == "checkSeat")
|
||||
{
|
||||
var num = periodExam.Candidate.Count() + 1;
|
||||
var num = periodExam.Count() + 1;
|
||||
candidate.ExamIdenNumber = "CDC-" + num;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (item != null)
|
||||
{
|
||||
if (candidate.Status == "checkPoint")
|
||||
if (candidate.Status == "checkPoint" || candidate.Status == "done")
|
||||
{
|
||||
candidate.Point = item.Point;
|
||||
candidate.Status = "done";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue