cronjob ส่งข้อมูลผู้เกษียณไปให้ระบบพ้นราชการ #2330
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m17s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m17s
This commit is contained in:
parent
e6c3e80a3d
commit
93d4857ea1
4 changed files with 175 additions and 12 deletions
|
|
@ -104,6 +104,7 @@ import { PostRetireToExprofile } from "./ExRetirementController";
|
|||
import { LeaveType } from "../entities/LeaveType";
|
||||
import { KeycloakAttributeService } from "../services/KeycloakAttributeService";
|
||||
import { reOrderCommandRecivesAndDelete } from "../services/CommandService";
|
||||
import { RetirementService } from "../services/RetirementService";
|
||||
@Route("api/v1/org/command")
|
||||
@Tags("Command")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -1608,8 +1609,7 @@ export class CommandController extends Controller {
|
|||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
// @Get("XXX")
|
||||
async cronjobUpdateRetirementStatus(/*@Request() request: RequestWithUser*/) {
|
||||
async cronjobUpdateRetirementStatus() {
|
||||
const adminToken = (await getToken()) ?? "";
|
||||
const today = new Date();
|
||||
today.setUTCHours(0, 0, 0, 0);
|
||||
|
|
@ -1887,6 +1887,21 @@ export class CommandController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ทดสอบ cronjobPostRetireToExprofile
|
||||
* @summary ทดสอบส่งข้อมูลผู้เกษียณไปยังระบบพ้นราชการ (Exprofile)
|
||||
*/
|
||||
@Get("cronjob/cronjobPostRetireToExprofile")
|
||||
async runCronjobPostRetireToExprofile() {
|
||||
try {
|
||||
const retirementService = new RetirementService();
|
||||
const result = await retirementService.cronjobPostRetireToExprofile();
|
||||
return new HttpSuccess(result);
|
||||
} catch (error: any) {
|
||||
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error.message || "เกิดข้อผิดพลาด");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการคำสั่ง tab4 คำสั่ง
|
||||
*
|
||||
|
|
|
|||
|
|
@ -237,16 +237,19 @@ export async function PostRetireToExprofile(
|
|||
continue;
|
||||
}
|
||||
|
||||
addLogSequence(request, {
|
||||
action: "request",
|
||||
status: "error",
|
||||
description: "unconnected to exprofile api",
|
||||
request: {
|
||||
method: "POST",
|
||||
url: API_URL_BANGKOK + "/importData",
|
||||
response: JSON.stringify(error),
|
||||
},
|
||||
});
|
||||
// เช็ค request ก่อนเรียก addLogSequence (สำหรับ cronjob ที่ส่ง null)
|
||||
if (request) {
|
||||
addLogSequence(request, {
|
||||
action: "request",
|
||||
status: "error",
|
||||
description: "unconnected to exprofile api",
|
||||
request: {
|
||||
method: "POST",
|
||||
url: API_URL_BANGKOK + "/importData",
|
||||
response: JSON.stringify(error),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ไม่สามารถติดต่อ API ได้");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue