เช็คอายุราชการ #661

This commit is contained in:
AdisakKanthawilang 2024-10-29 16:59:57 +07:00
parent 89fbc0225f
commit 6b3b77337e
4 changed files with 85 additions and 118 deletions

View file

@ -12,9 +12,9 @@ export class AppController extends Controller {
return { message: "Hello World 1" };
}
// @Post()
// public async Post(@Query() profileId: string) {
// const result = calculateGovAge(profileId);
// return new HttpSuccess(result);
// }
@Post()
public async Post(@Query() profileId: string) {
const result = calculateGovAge(profileId,"OFFICER");
return new HttpSuccess(result);
}
}

View file

@ -8,7 +8,7 @@ import { Profile } from "../entities/Profile";
import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
import { Position } from "../entities/Position";
import { PosMaster } from "../entities/PosMaster";
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
import { calculateAge, calculateGovAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
import permission from "../interfaces/permission";
import { OrgRevision } from "../entities/OrgRevision";
@Route("api/v1/org/profile/government")
@ -119,7 +119,8 @@ export class ProfileGovernmentHistoryController extends Controller {
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
govAge: await calculateGovAge(profile.id,"OFFICER"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,
@ -229,7 +230,8 @@ export class ProfileGovernmentHistoryController extends Controller {
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
govAge: await calculateGovAge(profileId,"OFFICER"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,
@ -322,7 +324,8 @@ export class ProfileGovernmentHistoryController extends Controller {
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
govAge: await calculateGovAge(profileId,"OFFICER"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,

View file

@ -8,7 +8,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
import { EmployeePosition } from "../entities/EmployeePosition";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { calculateAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
import { calculateAge, calculateGovAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
import permission from "../interfaces/permission";
import { OrgRevision } from "../entities/OrgRevision";
@Route("api/v1/org/profile-employee/government")
@ -108,7 +108,8 @@ export class ProfileGovernmentEmployeeController extends Controller {
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
govAge: await calculateGovAge(profile.id,"EMPLOYEE"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,
@ -211,7 +212,8 @@ export class ProfileGovernmentEmployeeController extends Controller {
dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ
govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId,"EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
@ -294,7 +296,8 @@ export class ProfileGovernmentEmployeeController extends Controller {
dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ
govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId,"EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย