Fix [Bug] คำนวนระยะเวลาดำรงตำแหน่งในสายงาน, ระยะเวลาดำรงตำแหน่งตามระดับ และทางการบริหารของคนที่พ้นจากราชการ #137

This commit is contained in:
Bright 2025-07-18 13:41:52 +07:00
parent ea74db7005
commit 42cc69cbbe
5 changed files with 131 additions and 22 deletions

View file

@ -5244,6 +5244,8 @@ export class OrganizationDotnetController extends Controller {
*/
@Get("profile-leave/keycloak/{keycloakId}")
async GetProfileLeaveByKeycloakIdAsync(@Path() keycloakId: string) {
const CURRENT_DATE = await AppDataSource.query("SELECT CURRENT_DATE() as today");
let _currentDate = CURRENT_DATE[0].today;
const profile = await this.profileRepo.findOne({
relations: [
"posLevel",
@ -5317,8 +5319,9 @@ export class OrganizationDotnetController extends Controller {
oc = `${_profileCurrent.orgChild4?.orgChild4Name}`;
}
}
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?, ?)", [
profile.id,
_currentDate
]);
const _position = position.length > 0 ? position[0] : [];
@ -5429,7 +5432,12 @@ export class OrganizationDotnetController extends Controller {
oc = `${_profileCurrent.orgChild4?.orgChild4Name}`;
}
}
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [profile.id]);
if (profile && profile?.isLeave) {
_currentDate = profile && profile.leaveDate
? Extension.toDateOnlyString(profile.leaveDate)
: _currentDate
}
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?, ?)", [profile.id, _currentDate]);
const _position = position.length > 0 ? position[0] : [];
const mapProfile = {