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>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการผู้สมัครทำการบันทึกหลักฐานชำระเงิน สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("payment/{examId:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PaymentedCandidateService(string examId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _candidateService.UserCheckCandidateService(examId, "checkPayment");
|
||||
// /// <summary>
|
||||
// /// ผู้สมัครทำการบันทึกหลักฐานชำระเงิน
|
||||
// /// </summary>
|
||||
// /// <param name="examId">รหัสรอบสมัคร</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200">เมื่อทำการผู้สมัครทำการบันทึกหลักฐานชำระเงิน สำเร็จ</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("payment/{examId:length(36)}")]
|
||||
// [ProducesResponseType(StatusCodes.Status200OK)]
|
||||
// [ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
// [ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
// public async Task<ActionResult<ResponseObject>> PaymentedCandidateService(string examId)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// await _candidateService.UserCheckCandidateService(examId, "checkPayment");
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
// return Success();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return Error(ex);
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <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>
|
||||
|
|
@ -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>
|
||||
/// list เอกสารหลักฐาน
|
||||
/// </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>
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue