api อัพโหลดหลักฐานชำระเงิน
This commit is contained in:
parent
eb8047e7ad
commit
dee47f326d
6 changed files with 155 additions and 136 deletions
|
|
@ -638,31 +638,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// ผู้สมัครทำการบันทึกหลักฐานชำระเงิน
|
// /// ผู้สมัครทำการบันทึกหลักฐานชำระเงิน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
// /// <param name="examId">รหัสรอบสมัคร</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200">เมื่อทำการผู้สมัครทำการบันทึกหลักฐานชำระเงิน สำเร็จ</response>
|
// /// <response code="200">เมื่อทำการผู้สมัครทำการบันทึกหลักฐานชำระเงิน สำเร็จ</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("payment/{examId:length(36)}")]
|
// [HttpGet("payment/{examId:length(36)}")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
// [ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
// [ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
// [ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public async Task<ActionResult<ResponseObject>> PaymentedCandidateService(string examId)
|
// public async Task<ActionResult<ResponseObject>> PaymentedCandidateService(string examId)
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
await _candidateService.UserCheckCandidateService(examId, "checkPayment");
|
// await _candidateService.UserCheckCandidateService(examId, "checkPayment");
|
||||||
|
|
||||||
return Success();
|
// return Success();
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
return Error(ex);
|
// return Error(ex);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// เจ้าหน้าที่ตรวจการชำระเงิน
|
/// เจ้าหน้าที่ตรวจการชำระเงิน
|
||||||
|
|
@ -716,6 +716,42 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get id รูปถ่าย
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อ get id รูปถ่ายสำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("profile-image/{examId:length(36)}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetsAsyncProfileImage(string examId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var doc = await _candidateService.GetsAsyncProfileImage(examId);
|
||||||
|
|
||||||
|
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>
|
||||||
/// อัปโหลดรูปถ่ายผู้สมัคร
|
/// อัปโหลดรูปถ่ายผู้สมัคร
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -751,6 +787,75 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get id หลักฐานชำระ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อ get id หลักฐานชำระสำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("payment-image/{examId:length(36)}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetsAsyncPaymentImg(string examId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var doc = await _candidateService.GetsAsyncPaymentImg(examId);
|
||||||
|
|
||||||
|
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>
|
||||||
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่ออัปเอกสารหลักฐานสำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPut("payment-image/{examId:length(36)}"), DisableRequestSizeLimit]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UploadPaymentCandidateService(string examId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||||
|
{
|
||||||
|
return Error(GlobalMessages.NoFileToUpload);
|
||||||
|
}
|
||||||
|
|
||||||
|
var file = Request.Form.Files[0];
|
||||||
|
await _candidateService.UpdateAsyncPaymentImage(examId, file);
|
||||||
|
await _candidateService.UserCheckCandidateService(examId, "checkPayment");
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// list เอกสารหลักฐาน
|
/// list เอกสารหลักฐาน
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -777,72 +882,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// get id รูปถ่าย
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <response code="200">เมื่อ get id รูปถ่ายสำเร็จ</response>
|
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
||||||
[HttpGet("profile-img/{examId:length(36)}")]
|
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
||||||
public async Task<ActionResult<ResponseObject>> GetsAsyncProfileImage(string examId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var doc = await _candidateService.GetsAsyncProfileImage(examId);
|
|
||||||
|
|
||||||
var file_data = await _minioService.DownloadFileAsync(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>
|
|
||||||
/// get id หลักฐานชำระ
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <response code="200">เมื่อ get id หลักฐานชำระสำเร็จ</response>
|
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
||||||
[HttpGet("payment-img/{examId:length(36)}")]
|
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
||||||
public async Task<ActionResult<ResponseObject>> GetsAsyncPaymentImg(string examId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var doc = await _candidateService.GetsAsyncPaymentImg(examId);
|
|
||||||
|
|
||||||
var file_data = await _minioService.DownloadFileAsync(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>
|
||||||
/// อัปโหลดเอกสารหลักฐาน
|
/// อัปโหลดเอกสารหลักฐาน
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -931,38 +970,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// อัปเอกสารหลักฐานการชำระเงิน
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <response code="200">เมื่ออัปเอกสารหลักฐานสำเร็จ</response>
|
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
||||||
[HttpPut("upload-payment/{examId:length(36)}"), DisableRequestSizeLimit]
|
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
||||||
public async Task<ActionResult<ResponseObject>> UploadPaymentCandidateService(string examId)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
|
||||||
{
|
|
||||||
return Error(GlobalMessages.NoFileToUpload);
|
|
||||||
}
|
|
||||||
|
|
||||||
var file = Request.Form.Files[0];
|
|
||||||
await _candidateService.UpdateAsyncPaymentImage(examId, file);
|
|
||||||
|
|
||||||
return Success();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Error(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
throw new Exception(GlobalMessages.ExamNotFound);
|
throw new Exception(GlobalMessages.ExamNotFound);
|
||||||
|
|
||||||
var candidate = await _context.Candidates.AsQueryable()
|
var candidate = await _context.Candidates.AsQueryable()
|
||||||
.Include(x=>x.ProfileImg)
|
.Include(x => x.ProfileImg)
|
||||||
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
|
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
@ -277,7 +277,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
throw new Exception(GlobalMessages.ExamNotFound);
|
throw new Exception(GlobalMessages.ExamNotFound);
|
||||||
|
|
||||||
var candidate = await _context.Candidates.AsQueryable()
|
var candidate = await _context.Candidates.AsQueryable()
|
||||||
.Include(x=>x.PaymentImg)
|
.Include(x => x.PaymentImg)
|
||||||
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
|
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
@ -594,11 +594,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
var candidateId = await CreateAsyncCandidate(examId);
|
var candidateId = await CreateAsyncCandidate(examId);
|
||||||
|
|
||||||
var candidate = await _context.Candidates.AsQueryable()
|
var candidate = await _context.Candidates.AsQueryable()
|
||||||
|
.Include(x => x.ProfileImg)
|
||||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
|
||||||
|
|
||||||
if (candidate == null)
|
if (candidate == null)
|
||||||
throw new Exception(GlobalMessages.ExamNotFound);
|
throw new Exception(GlobalMessages.ExamNotFound);
|
||||||
|
|
||||||
|
if (candidate.ProfileImg != null)
|
||||||
|
{
|
||||||
|
await DeleteAsyncDocument(candidate.ProfileImg.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
var doc = await _minioService.UploadFileAsync(file);
|
var doc = await _minioService.UploadFileAsync(file);
|
||||||
|
|
||||||
var document = await _context.Documents.AsQueryable()
|
var document = await _context.Documents.AsQueryable()
|
||||||
|
|
@ -1010,11 +1016,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
var candidateId = await CreateAsyncCandidate(examId);
|
var candidateId = await CreateAsyncCandidate(examId);
|
||||||
|
|
||||||
var candidate = await _context.Candidates.AsQueryable()
|
var candidate = await _context.Candidates.AsQueryable()
|
||||||
|
.Include(x => x.PaymentImg)
|
||||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
|
||||||
|
|
||||||
if (candidate == null)
|
if (candidate == null)
|
||||||
throw new Exception(GlobalMessages.ExamNotFound);
|
throw new Exception(GlobalMessages.ExamNotFound);
|
||||||
|
|
||||||
|
if (candidate.PaymentImg != null)
|
||||||
|
{
|
||||||
|
await DeleteAsyncDocument(candidate.PaymentImg.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
var doc = await _minioService.UploadFileAsync(file);
|
var doc = await _minioService.UploadFileAsync(file);
|
||||||
|
|
||||||
var document = await _context.Documents.AsQueryable()
|
var document = await _context.Documents.AsQueryable()
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
"Endpoint": "http://127.0.0.1:9000",
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
"AccessKey": "lLXkeFav7rtu3GlP",
|
"AccessKey": "frappet",
|
||||||
"SecretKey": "K8KxwNyqedWy7p2HPsTJRoMOlnoXgDa1",
|
"SecretKey": "P@ssw0rd",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
"Endpoint": "http://127.0.0.1:9000",
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
"AccessKey": "lLXkeFav7rtu3GlP",
|
"AccessKey": "frappet",
|
||||||
"SecretKey": "K8KxwNyqedWy7p2HPsTJRoMOlnoXgDa1",
|
"SecretKey": "P@ssw0rd",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
"Endpoint": "http://127.0.0.1:9000",
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
"AccessKey": "lLXkeFav7rtu3GlP",
|
"AccessKey": "frappet",
|
||||||
"SecretKey": "K8KxwNyqedWy7p2HPsTJRoMOlnoXgDa1",
|
"SecretKey": "P@ssw0rd",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
"Endpoint": "http://127.0.0.1:9000",
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
"AccessKey": "lLXkeFav7rtu3GlP",
|
"AccessKey": "frappet",
|
||||||
"SecretKey": "K8KxwNyqedWy7p2HPsTJRoMOlnoXgDa1",
|
"SecretKey": "P@ssw0rd",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue