api ปฏิเสธจ่ายเงิน get ไฟล์สมัครสอบ
This commit is contained in:
parent
9486ad160d
commit
5abeada4a6
32 changed files with 7513 additions and 394 deletions
|
|
@ -227,6 +227,136 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูล home page cms
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการข้อมูล home page cms สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("home")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<HomePageResponseItem?> GetHomePageAsync()
|
||||
{
|
||||
// try
|
||||
// {
|
||||
var item = await _cmsCandidateService.GetHomePageAsync();
|
||||
|
||||
return item;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูล content home page
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการข้อมูล content home page สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("content/home")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<HomePageContentResponseItem?> GetHomePageContentAsync()
|
||||
{
|
||||
// try
|
||||
// {
|
||||
var item = await _cmsCandidateService.GetHomePageContentAsync();
|
||||
|
||||
return item;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูล content about page
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการข้อมูล content about page สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("content/about")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<AboutPageContentResponseItem?> GetAboutPageContentAsync()
|
||||
{
|
||||
// try
|
||||
// {
|
||||
var item = await _cmsCandidateService.GetAboutPageContentAsync();
|
||||
|
||||
return item;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List ข้อมูลรอบสมัครสอบ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการ List ข้อมูลรอบสมัครสอบ สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("qualifying")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IEnumerable<CMSExamResponseItem?>> GetsCMSExamsAsync(int limit = 0)
|
||||
{
|
||||
// try
|
||||
// {
|
||||
var items = await _cmsCandidateService.GetsCMSExamsAsync(limit);
|
||||
|
||||
return items;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get ข้อมูลรอบสมัครสอบ
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการ Get ข้อมูลรอบสมัครสอบ สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("qualifying/{examId:length(36)}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<CMSExamResponseItem?> GetCMSExamsAsync(string examId)
|
||||
{
|
||||
// try
|
||||
// {
|
||||
var item = await _cmsCandidateService.GetCMSExamsAsync(examId);
|
||||
|
||||
return item;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var items = await _candidateService.GetStatusCandidateService(examId, positionId);
|
||||
var item = await _candidateService.GetStatusCandidateService(examId, positionId);
|
||||
|
||||
return Success(GlobalMessages.Success, items);
|
||||
return Success(item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -756,19 +756,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var doc = await _candidateService.GetsAsyncProfileImage(examId, positionId);
|
||||
var path = await _candidateService.GetsAsyncProfileImage(examId, positionId);
|
||||
|
||||
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;
|
||||
return Success(GlobalMessages.Success, path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -829,19 +819,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var doc = await _candidateService.GetsAsyncPaymentImg(examId, positionId);
|
||||
var path = await _candidateService.GetsAsyncPaymentImg(examId, positionId);
|
||||
|
||||
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;
|
||||
return Success(GlobalMessages.Success, path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -865,19 +845,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var doc = await _candidateService.GetsAsyncPaymentImgCandidate(candidateId);
|
||||
var path = 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;
|
||||
return Success(GlobalMessages.Success, path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -987,15 +957,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
/// <response code="200">เมื่อลบเอกสารหลักฐานสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("upload/{documentId:length(36)}"), DisableRequestSizeLimit]
|
||||
[HttpDelete("upload/{examId:length(36)}/{positionId:length(36)}"), DisableRequestSizeLimit]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteFileCandidateService(string documentId)
|
||||
public async Task<ActionResult<ResponseObject>> DeleteFileCandidateService(string examId, string positionId, string documentId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _candidateService.DeleteAsyncDocument(documentId);
|
||||
await _candidateService.DeleteAsyncDocument(examId, positionId, documentId);
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -1061,7 +1031,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
#region " Fields "
|
||||
|
||||
private readonly PeriodExamService _periodExamService;
|
||||
private readonly MinIOService _minioService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PeriodExamController(PeriodExamService periodExamService)
|
||||
public PeriodExamController(PeriodExamService periodExamService, MinIOService minioService)
|
||||
{
|
||||
_periodExamService = periodExamService;
|
||||
_minioService = minioService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -119,7 +121,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
/// <response code="200">เมื่อทำการอ่านข้อมูลรอบการสมัครสอบ และ คนสมัครสอบในรอบสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost, DisableRequestSizeLimit]
|
||||
[HttpPost]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
|
|
@ -127,15 +129,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
var items = await _periodExamService.CreateAsync(item);
|
||||
|
||||
var files = Request.Form.Files;
|
||||
await _periodExamService.CreateAsync(item, files);
|
||||
|
||||
return Success();
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -152,11 +148,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
/// <response code="200">เมื่อทำการอ่านข้อมูลรอบการสมัครสอบ และ คนสมัครสอบในรอบสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("{examId:length(36)}"), DisableRequestSizeLimit]
|
||||
[HttpPut("{examId:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateAsync(string examId, RequestPeriodExam item)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _periodExamService.UpdateAsync(examId, item);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูลรอบการสมัครสอบ และ คนสมัครสอบในรอบ
|
||||
/// </summary>
|
||||
/// <param name="type">ประเภทเอกสาร</param>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลรอบการสมัครสอบ และ คนสมัครสอบในรอบสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("{type}/{examId:length(36)}"), DisableRequestSizeLimit]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDocAsync(string type, string examId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -166,8 +189,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
var files = Request.Form.Files;
|
||||
|
||||
await _periodExamService.UpdateAsync(examId, item, files);
|
||||
if (type == "img")
|
||||
{
|
||||
await _periodExamService.UpdateImgAsync(examId, files);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _periodExamService.UpdateDocAsync(examId, files);
|
||||
}
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -463,6 +492,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูล เอกสาร ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="candidate">รหัสผู้สมัคร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการดึง ข้อมูล เอกสาร ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("document/{candidate:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsyncDocument(string candidate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _periodExamService.GetsAsyncDocument(candidate);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูลที่นั่งสอบ
|
||||
/// </summary>
|
||||
|
|
@ -589,6 +644,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบเอกไฟล์
|
||||
/// </summary>
|
||||
/// <param name="documentId">รหัสไฟล์เอกสาร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อลบเอกไฟล์สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("doc/{examId:length(36)}"), DisableRequestSizeLimit]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteFileCandidateService(string examId, string documentId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _periodExamService.DeleteAsyncDocument(examId, documentId);
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue