ส่งวินัยไปออกคำสั่ง

This commit is contained in:
Kittapath 2023-12-22 15:29:24 +07:00
parent e8a288b4b2
commit f644654384
21 changed files with 24913 additions and 84 deletions

View file

@ -2,6 +2,7 @@
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@ -98,7 +99,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW").Select(p => new
{
Id = p.Id,
Idcard = p.CitizenId,
@ -186,34 +187,34 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
return Success(data.Id);
}
/// <summary>
/// สั่งรายชื่อไปออกคำสั่งให้ออกจากราชการไว้ก่อน
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req, Guid commandTypeId)
{
foreach (var item in req.Id)
{
var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.FirstOrDefaultAsync(x => x.Id == item);
if (uppdated == null)
continue;
// /// <summary>
// /// สั่งรายชื่อไปออกคำสั่งให้ออกจากราชการไว้ก่อน
// /// </summary>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpPut("report/{commandTypeId:length(36)}")]
// public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req, Guid commandTypeId)
// {
// foreach (var item in req.Id)
// {
// var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
// .FirstOrDefaultAsync(x => x.Id == item);
// if (uppdated == null)
// continue;
uppdated.CommandTypeId = commandTypeId;
uppdated.Status = "REPORT";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
}
// uppdated.CommandTypeId = commandTypeId;
// uppdated.Status = "REPORT";
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
// uppdated.LastUpdateUserId = UserId ?? "";
// uppdated.LastUpdatedAt = DateTime.Now;
// }
await _context.SaveChangesAsync();
return Success();
}
// await _context.SaveChangesAsync();
// return Success();
// }
/// <summary>
/// อัพไฟล์เอกสารสืบสวนวินัย
@ -297,5 +298,105 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
return Error(new Exception("ไม่พบไฟล์นี้ในระบบ"), (int)StatusCodes.Status404NotFound);
}
}
/// <summary>
/// รายชื่อออกคำสั่งลงโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/up")]
public async Task<ActionResult<ResponseObject>> GetPersonReportUp()
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.Status == "REPORT")
.Select(x => new
{
Id = x.PersonId,
CommandId = x.CommandTypeId,
})
.ToListAsync();
return Success(data);
}
/// <summary>
/// รายชื่อออกคำสั่งงด/ลดโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/down")]
public async Task<ActionResult<ResponseObject>> GetPersonReportDown()
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.StatusDiscard == "REPORT")
.Select(x => new
{
Id = x.PersonId,
CommandId = x.CommandTypeDiscardId,
})
.ToListAsync();
return Success(data);
}
/// <summary>
/// รายชื่อออกคำสั่งยุติ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/reject")]
public async Task<ActionResult<ResponseObject>> GetPersonReportReject()
{
var data1 = await _context.DisciplineInvestigate_ProfileComplaints
.Where(x => x.IsReport == "REPORT")
.Select(x => new
{
Id = x.PersonId,
})
.ToListAsync();
var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.IsReport == "REPORT")
.Select(x => new
{
Id = x.PersonId,
})
.ToListAsync();
foreach (var data in data1)
{
data2.Add(data);
};
return Success(data2);
}
/// <summary>
/// รายชื่อออกคำสั่งพักราชการ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/stop")]
public async Task<ActionResult<ResponseObject>> GetPersonReportStop()
{
var data = await _context.DisciplineReport_Profiles
.Where(x => x.Status == "REPORT")
.Select(x => new
{
Id = x.PersonId,
CommandId = x.CommandTypeId,
})
.ToListAsync();
return Success(data);
}
}
}