add finish status
This commit is contained in:
parent
149003131c
commit
1a5adfa6d3
1 changed files with 39 additions and 6 deletions
|
|
@ -11,6 +11,7 @@ import {
|
|||
Body,
|
||||
Query,
|
||||
Put,
|
||||
Patch,
|
||||
} from "tsoa";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
|
|
@ -424,6 +425,39 @@ export class EvaluateResultController extends Controller {
|
|||
});
|
||||
setLogDataDiff(request, { before: null, after: postData });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API บันทึกข้อมูลแบบรายงานการประเมินฯ
|
||||
*
|
||||
* @summary บันทึกข้อมูลแบบรายงานการประเมินฯ
|
||||
*
|
||||
*/
|
||||
@Patch("")
|
||||
async PatchData(
|
||||
@Query() assign_id: string,
|
||||
@Query() evaluate_no: number | string,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_PROBATION");
|
||||
|
||||
const assign = await this.assignRepository.findOne({
|
||||
relations: ["profile"],
|
||||
where: { id: assign_id },
|
||||
});
|
||||
if (!assign) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบมอบหมายงาน");
|
||||
}
|
||||
|
||||
const result = await this.evaluateResultRepository.findOne({
|
||||
where: { assign_id, no: evaluate_no.toString() },
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผลการประเมิน");
|
||||
}
|
||||
|
||||
const personal = await this.personalRepository.findOne({
|
||||
where: { personal_id: assign.personal_id },
|
||||
});
|
||||
|
|
@ -432,21 +466,21 @@ export class EvaluateResultController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลบุคคล");
|
||||
}
|
||||
personal.probation_status =
|
||||
requestBody.pass_result == 1
|
||||
result.pass_result == 1
|
||||
? 2 // ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อ
|
||||
: requestBody.pass_result == 2
|
||||
: result.pass_result == 2
|
||||
? 3 // ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกจากราชการ
|
||||
: requestBody.pass_result == 4
|
||||
: result.pass_result == 4
|
||||
? 1 // ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป
|
||||
: personal.probation_status;
|
||||
|
||||
if (requestBody.pass_result == 3) {
|
||||
if (result.pass_result == 3) {
|
||||
personal.probation_status = 7;
|
||||
// #noti ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ กรณีขยายระยะเวลา
|
||||
await new CallAPI()
|
||||
.PostData(request, "/placement/noti", {
|
||||
subject: "ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ",
|
||||
body: `ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ เห็นควรให้ขยายระยะเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก ${requestBody.expand_month} เดือน`,
|
||||
body: `ผลการประเมินการทดลองปฏิบัติหน้าที่ราชการ เห็นควรให้ขยายระยะเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก ${result.expand_month} เดือน`,
|
||||
receiverUserId: assign.personal_id,
|
||||
payload: "",
|
||||
isSendMail: false,
|
||||
|
|
@ -459,7 +493,6 @@ export class EvaluateResultController extends Controller {
|
|||
}
|
||||
|
||||
await this.personalRepository.save(personal, { data: request });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue