update
This commit is contained in:
parent
935ec5dae2
commit
c5c8ccd8c0
4 changed files with 296 additions and 172 deletions
|
|
@ -19,6 +19,7 @@ import HttpError from "../interfaces/http-error";
|
||||||
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import { Profile } from "../entities/Profile";
|
import { Profile } from "../entities/Profile";
|
||||||
|
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
import { In, LessThan, MoreThan } from "typeorm";
|
import { In, LessThan, MoreThan } from "typeorm";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import { setLogDataDiff } from "../interfaces/utils";
|
import { setLogDataDiff } from "../interfaces/utils";
|
||||||
|
|
@ -31,57 +32,195 @@ import { TenureLevelEmployee } from "../entities/TenureLevelEmployee";
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
export class ProfileSalaryController extends Controller {
|
export class ProfileSalaryController extends Controller {
|
||||||
private profileRepo = AppDataSource.getRepository(Profile);
|
private profileRepo = AppDataSource.getRepository(Profile);
|
||||||
|
private profileEmployeeRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||||
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
||||||
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
||||||
private positionOfficerRepo = AppDataSource.getRepository(TenurePositionOfficer);
|
private positionOfficerRepo = AppDataSource.getRepository(TenurePositionOfficer);
|
||||||
|
private positionEmployeeRepo = AppDataSource.getRepository(TenurePositionEmployee);
|
||||||
private levelOfficerRepo = AppDataSource.getRepository(TenureLevelOfficer);
|
private levelOfficerRepo = AppDataSource.getRepository(TenureLevelOfficer);
|
||||||
// async cronjobTenurePositionOfficer() {
|
private levelEmployeeRepo = AppDataSource.getRepository(TenureLevelEmployee);
|
||||||
@Get("XXX")
|
|
||||||
|
@Get("TenurePositionOfficer")
|
||||||
public async cronjobTenurePositionOfficer() {
|
public async cronjobTenurePositionOfficer() {
|
||||||
let data: any = [];
|
let data: any = [];
|
||||||
const profile = await this.profileRepo.find({
|
const positionOfficer = await this.positionOfficerRepo.find();
|
||||||
where: { id: "09e89026-c420-4136-bd9e-7e408f530b69" },
|
await this.positionOfficerRepo.remove(positionOfficer);
|
||||||
});
|
const profile = await this.profileRepo.find();
|
||||||
await Promise.all(
|
for await (const x of profile) {
|
||||||
profile.map(async (x) => {
|
|
||||||
const sql_mode = await AppDataSource.query(
|
|
||||||
"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));",
|
|
||||||
);
|
|
||||||
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [x.id]);
|
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [x.id]);
|
||||||
const _position = position.length > 0 ? position[0] : [];
|
const _position = position.length > 0 ? position[0] : [];
|
||||||
const mapPosition =
|
const mapPosition =
|
||||||
_position.length > 1
|
_position.length > 1
|
||||||
? _position.slice(1).map((curr: any, index: number) => ({
|
? _position.slice(1)
|
||||||
|
.map((curr: any, index: number) => ({
|
||||||
days_diff: curr.days_diff,
|
days_diff: curr.days_diff,
|
||||||
positionName: _position[index]?.positionName,
|
positionName: _position[index]?.positionName,
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
const calDayDiff = mapPosition
|
const calDayDiff = mapPosition
|
||||||
.filter((curr: any) => curr.positionName == x.position)
|
.filter((curr: any) => curr.positionName == x.position)
|
||||||
.reduce(
|
.reduce(
|
||||||
(acc: any, curr: any) => {
|
(acc: any, curr: any) => {
|
||||||
acc.days_diff += Number(curr.days_diff) || 0;
|
acc.days_diff += Number(curr.days_diff) || 0;
|
||||||
|
acc.positionName = curr.positionName
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{ days_diff: 0 },
|
{ days_diff: 0,positionName: null}
|
||||||
);
|
);
|
||||||
console.log("==========> ", calDayDiff);
|
const mapData:any = {
|
||||||
const _mapData = {
|
|
||||||
profileId: x.id,
|
profileId: x.id,
|
||||||
positionName: x.position,
|
positionName: calDayDiff.positionName,
|
||||||
days_diff: null,
|
days_diff: calDayDiff.days_diff,
|
||||||
Years: null,
|
Years: (calDayDiff.days_diff / 365.2524).toFixed(4),
|
||||||
Months: null,
|
Months: (calDayDiff.days_diff / 30.4375 %12).toFixed(4),
|
||||||
Days: null,
|
Days: (calDayDiff.days_diff % 30.4375).toFixed(4),
|
||||||
};
|
}
|
||||||
data.push(_mapData);
|
// data.push(_mapData);
|
||||||
}),
|
await this.positionOfficerRepo.save(mapData);
|
||||||
|
}
|
||||||
// await this.positionOfficerRepo.save(data);
|
// await this.positionOfficerRepo.save(data);
|
||||||
);
|
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
@Get("TenurePositionEmployee")
|
||||||
|
public async cronjobTenurePositionEmployee() {
|
||||||
|
let data: any = [];
|
||||||
|
const positionEmployee = await this.positionEmployeeRepo.find();
|
||||||
|
await this.positionEmployeeRepo.remove(positionEmployee);
|
||||||
|
const profile = await this.profileEmployeeRepo.find();
|
||||||
|
for await (const x of profile) {
|
||||||
|
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [x.id]);
|
||||||
|
const _position = position.length > 0 ? position[0] : [];
|
||||||
|
const mapPosition =
|
||||||
|
_position.length > 1
|
||||||
|
? _position.slice(1)
|
||||||
|
.map((curr: any, index: number) => ({
|
||||||
|
days_diff: curr.days_diff,
|
||||||
|
positionName: _position[index]?.positionName,
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
const calDayDiff = mapPosition
|
||||||
|
.filter((curr: any) => curr.positionName == x.position)
|
||||||
|
.reduce(
|
||||||
|
(acc: any, curr: any) => {
|
||||||
|
acc.days_diff += Number(curr.days_diff) || 0;
|
||||||
|
acc.positionName = curr.positionName
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{ days_diff: 0,positionName: null}
|
||||||
|
);
|
||||||
|
const mapData:any = {
|
||||||
|
profileEmployeeId: x.id,
|
||||||
|
positionName: calDayDiff.positionName,
|
||||||
|
days_diff: calDayDiff.days_diff,
|
||||||
|
Years: (calDayDiff.days_diff / 365.2524).toFixed(4),
|
||||||
|
Months: (calDayDiff.days_diff / 30.4375 %12).toFixed(4),
|
||||||
|
Days: (calDayDiff.days_diff % 30.4375).toFixed(4),
|
||||||
|
}
|
||||||
|
// data.push(_mapData);
|
||||||
|
await this.positionEmployeeRepo.save(mapData);
|
||||||
|
}
|
||||||
|
// await this.positionEmployeeRepo.save(data);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
@Get("TenureLevelOfficer")
|
||||||
|
public async cronjobTenureLevelOfficer() {
|
||||||
|
let data: any = [];
|
||||||
|
const positionOfficer = await this.levelOfficerRepo.find();
|
||||||
|
await this.levelOfficerRepo.remove(positionOfficer);
|
||||||
|
const profile = await this.profileRepo.find({relations:["posLevel"]});
|
||||||
|
for await (const x of profile) {
|
||||||
|
const positionLevel = await AppDataSource.query("CALL GetProfileSalaryLevel(?)", [x.id]);
|
||||||
|
const _positionLevel = positionLevel.length > 0 ? positionLevel[0] : [];
|
||||||
|
const mapPositionLevel =
|
||||||
|
_positionLevel.length > 1
|
||||||
|
? _positionLevel.slice(1)
|
||||||
|
.map((curr: any, index: number) => ({
|
||||||
|
days_diff: curr.days_diff,
|
||||||
|
positionType: _positionLevel[index]?.positionType,
|
||||||
|
positionLevel: _positionLevel[index]?.positionLevel,
|
||||||
|
positionCee: _positionLevel[index]?.positionCee,
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
const calDayDiff = mapPositionLevel
|
||||||
|
.filter((curr: any) => curr.positionLevel == (x.posLevel?.posLevelName ??null))
|
||||||
|
.reduce(
|
||||||
|
(acc: any, curr: any) => {
|
||||||
|
acc.days_diff += Number(curr.days_diff) || 0;
|
||||||
|
acc.positionType = curr.positionType
|
||||||
|
acc.positionLevel = curr.positionLevel
|
||||||
|
acc.positionCee = curr.positionCee
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{ days_diff: 0,positionType:null,positionLevel:null,positionCee:null}
|
||||||
|
);
|
||||||
|
const mapData:any = {
|
||||||
|
profileId: x.id,
|
||||||
|
positionType: calDayDiff.positionType,
|
||||||
|
positionLevel: calDayDiff.positionLevel,
|
||||||
|
positionCee: calDayDiff.positionCee,
|
||||||
|
days_diff: calDayDiff.days_diff,
|
||||||
|
Years: x.posLevel == null? 0:((calDayDiff.days_diff / 365.2524).toFixed(4)),
|
||||||
|
Months: x.posLevel == null? 0:((calDayDiff.days_diff / 30.4375 %12).toFixed(4)),
|
||||||
|
Days: x.posLevel == null? 0:((calDayDiff.days_diff % 30.4375).toFixed(4)),
|
||||||
|
}
|
||||||
|
// data.push(_mapData);
|
||||||
|
await this.levelOfficerRepo.save(mapData);
|
||||||
|
}
|
||||||
|
// await this.levelOfficerRepo.save(data);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
@Get("TenureLevelEmployee")
|
||||||
|
public async cronjobTenureLevelEmployee() {
|
||||||
|
let data: any = [];
|
||||||
|
const positionEmployee = await this.levelEmployeeRepo.find();
|
||||||
|
await this.levelEmployeeRepo.remove(positionEmployee);
|
||||||
|
const profile = await this.profileEmployeeRepo.find({relations:["posLevel"]});
|
||||||
|
for await (const x of profile) {
|
||||||
|
const positionLevel = await AppDataSource.query("CALL GetProfileSalaryLevel(?)", [x.id]);
|
||||||
|
const _positionLevel = positionLevel.length > 0 ? positionLevel[0] : [];
|
||||||
|
const mapPositionLevel =
|
||||||
|
_positionLevel.length > 1
|
||||||
|
? _positionLevel.slice(1)
|
||||||
|
.map((curr: any, index: number) => ({
|
||||||
|
days_diff: curr.days_diff,
|
||||||
|
positionType: _positionLevel[index]?.positionType,
|
||||||
|
positionLevel: _positionLevel[index]?.positionLevel,
|
||||||
|
positionCee: _positionLevel[index]?.positionCee,
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
const calDayDiff = mapPositionLevel
|
||||||
|
.filter((curr: any) => curr.positionLevel == (x.posLevel?.posLevelName ??null))
|
||||||
|
.reduce(
|
||||||
|
(acc: any, curr: any) => {
|
||||||
|
acc.days_diff += Number(curr.days_diff) || 0;
|
||||||
|
acc.positionType = curr.positionType
|
||||||
|
acc.positionLevel = curr.positionLevel
|
||||||
|
acc.positionCee = curr.positionCee
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{ days_diff: 0,positionType:null,positionLevel:null,positionCee:null}
|
||||||
|
);
|
||||||
|
const mapData:any = {
|
||||||
|
profileEmployeeId: x.id,
|
||||||
|
positionType: calDayDiff.positionType,
|
||||||
|
positionLevel: calDayDiff.positionLevel,
|
||||||
|
positionCee: calDayDiff.positionCee,
|
||||||
|
days_diff: calDayDiff.days_diff,
|
||||||
|
Years: x.posLevel == null? 0:((calDayDiff.days_diff / 365.2524).toFixed(4)),
|
||||||
|
Months: x.posLevel == null? 0:((calDayDiff.days_diff / 30.4375 %12).toFixed(4)),
|
||||||
|
Days: x.posLevel == null? 0:((calDayDiff.days_diff % 30.4375).toFixed(4)),
|
||||||
|
}
|
||||||
|
// data.push(_mapData);
|
||||||
|
await this.levelEmployeeRepo.save(mapData);
|
||||||
|
}
|
||||||
|
// await this.levelEmployeeRepo.save(data);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
@Get("user")
|
@Get("user")
|
||||||
public async getSalaryUser(@Request() request: { user: Record<string, any> }) {
|
public async getSalaryUser(@Request() request: { user: Record<string, any> }) {
|
||||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ export class ReportController extends Controller {
|
||||||
if (tenureType != "" && tenureType == "position") {
|
if (tenureType != "" && tenureType == "position") {
|
||||||
tenureTypeCondition = "registryOfficer.Years BETWEEN :tenureMin AND :tenureMax";
|
tenureTypeCondition = "registryOfficer.Years BETWEEN :tenureMin AND :tenureMax";
|
||||||
} else if (tenureType != "" && tenureType == "level") {
|
} else if (tenureType != "" && tenureType == "level") {
|
||||||
tenureTypeCondition = "registryOfficer.levelYears BETWEEN :tenureMin AND :tenureMax"; //xxxxxxxxxxxx
|
tenureTypeCondition = "registryOfficer.levelYears BETWEEN :tenureMin AND :tenureMax";
|
||||||
}
|
}
|
||||||
|
|
||||||
const [lists, total] = await AppDataSource.getRepository(viewRegistryOfficer)
|
const [lists, total] = await AppDataSource.getRepository(viewRegistryOfficer)
|
||||||
|
|
@ -338,83 +338,58 @@ export class ReportController extends Controller {
|
||||||
.orderBy(`registryOfficer.${sortBy}`, sort)
|
.orderBy(`registryOfficer.${sortBy}`, sort)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
||||||
const mapData = await Promise.all(lists.map(async(x) => {
|
const mapData = await Promise.all(
|
||||||
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [x.profileId])
|
lists.map(async(x) => {
|
||||||
const _position = position.length > 0 ? position[0] : [];
|
return {
|
||||||
const lastPosition = _position.length > 0 ? _position[_position.length - 1] : null; // last row
|
profileId: x.profileId,
|
||||||
const mapPosition = lastPosition
|
citizenId: x.citizenId,
|
||||||
? [{
|
prefix: x.prefix,
|
||||||
Years: lastPosition.Years ? Math.floor(Number(lastPosition.Years)) : 0,
|
firstName: x.firstName,
|
||||||
Months: lastPosition.Months ? Math.floor(Number(lastPosition.Months)) : 0,
|
lastName: x.lastName,
|
||||||
Daysday: lastPosition.Days ? Math.floor(Number(lastPosition.Days)) : 0,
|
isProbation: x.isProbation,
|
||||||
}]
|
isLeave: x.isLeave,
|
||||||
: [];
|
isRetirement: x.isRetirement,
|
||||||
const posLevel = await AppDataSource.query("CALL GetProfileSalaryLevel(?)", [x.profileId])
|
leaveType: x.leaveType,
|
||||||
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
|
posMasterNo: x.posMasterNo,
|
||||||
const lastPosLevel= _posLevel.length > 0 ? _posLevel[_posLevel.length - 1] : null;
|
orgRootId: x.orgRootId,
|
||||||
const mapPosLevel = lastPosLevel
|
orgChild1Id: x.orgChild1Id,
|
||||||
? [{
|
orgChild2Id: x.orgChild2Id,
|
||||||
Years: lastPosLevel.Years ? Math.floor(Number(lastPosLevel.Years)) : 0,
|
orgChild3Id: x.orgChild3Id,
|
||||||
Months: lastPosLevel.Months ? Math.floor(Number(lastPosLevel.Months)) : 0,
|
orgChild4Id: x.orgChild4Id,
|
||||||
Daysday: lastPosLevel.Days ? Math.floor(Number(lastPosLevel.Days)) : 0,
|
orgRootName: x.orgRootName,
|
||||||
}]
|
orgChild1Name: x.orgChild1Name,
|
||||||
: [];
|
orgChild2Name: x.orgChild2Name,
|
||||||
return {
|
orgChild3Name: x.orgChild3Name,
|
||||||
profileId: x.profileId,
|
orgChild4Name: x.orgChild4Name,
|
||||||
citizenId: x.citizenId,
|
org: x.org,
|
||||||
prefix: x.prefix,
|
searchShortName: x.searchShortName,
|
||||||
firstName: x.firstName,
|
posExecutiveName: x.posExecutiveName,
|
||||||
lastName: x.lastName,
|
position: x.position,
|
||||||
isProbation: x.isProbation,
|
posTypeName: x.posTypeName,
|
||||||
isLeave: x.isLeave,
|
posLevelName: x.posLevelName,
|
||||||
isRetirement: x.isRetirement,
|
gender: x.gender,
|
||||||
leaveType: x.leaveType,
|
relationship: x.relationship,
|
||||||
posMasterNo: x.posMasterNo,
|
dateAppoint: x.dateAppoint,
|
||||||
orgRootId: x.orgRootId,
|
dateRetire: x.dateRetire,
|
||||||
orgChild1Id: x.orgChild1Id,
|
dateRetireLaw: x.dateRetireLaw,
|
||||||
orgChild2Id: x.orgChild2Id,
|
birthdate: x.birthdate,
|
||||||
orgChild3Id: x.orgChild3Id,
|
degree: x.degree,
|
||||||
orgChild4Id: x.orgChild4Id,
|
age: x.age,
|
||||||
orgRootName: x.orgRootName,
|
currentPosition: null,
|
||||||
orgChild1Name: x.orgChild1Name,
|
lengthPosition: null,
|
||||||
orgChild2Name: x.orgChild2Name,
|
positionDate: {
|
||||||
orgChild3Name: x.orgChild3Name,
|
Years: x.Years,
|
||||||
orgChild4Name: x.orgChild4Name,
|
Months: x.Months,
|
||||||
org: x.org,
|
Days: x.Days,
|
||||||
searchShortName: x.searchShortName,
|
},
|
||||||
posExecutiveName: x.posExecutiveName,
|
posLevelDate: {
|
||||||
position: x.position,
|
Years: x.levelYears,
|
||||||
posTypeName: x.posTypeName,
|
Months: x.levelMonths,
|
||||||
posLevelName: x.posLevelName,
|
Days: x.levelDays,
|
||||||
gender: x.gender,
|
},
|
||||||
relationship: x.relationship,
|
}
|
||||||
dateAppoint: x.dateAppoint,
|
|
||||||
dateRetire: x.dateRetire,
|
|
||||||
dateRetireLaw: x.dateRetireLaw,
|
|
||||||
birthdate: x.birthdate,
|
|
||||||
degree: x.degree,
|
|
||||||
age: x.age,
|
|
||||||
currentPosition: null,
|
|
||||||
lengthPosition: null,
|
|
||||||
// positionDate: {
|
|
||||||
// Years: x.Years,
|
|
||||||
// Months: x.Months,
|
|
||||||
// Days: x.Days,
|
|
||||||
// },
|
|
||||||
// posExcutiveDate: {
|
|
||||||
// Years: x.posExecutiveYears,
|
|
||||||
// Months: x.posExecutiveMonths,
|
|
||||||
// Days: x.posExecutiveDays,
|
|
||||||
// },
|
|
||||||
// posLevelDate: {
|
|
||||||
// Years: x.levelYears,
|
|
||||||
// Months: x.levelMonths,
|
|
||||||
// Days: x.levelDays,
|
|
||||||
// },
|
|
||||||
positionDate: mapPosition,
|
|
||||||
posLevelDate: mapPosLevel
|
|
||||||
}
|
}
|
||||||
}));
|
));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
data: mapData,
|
data: mapData,
|
||||||
total: total,
|
total: total,
|
||||||
|
|
@ -613,6 +588,13 @@ export class ReportController extends Controller {
|
||||||
parameters.retireType = retireType;
|
parameters.retireType = retireType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tenureTypeCondition = "1=1";
|
||||||
|
if (tenureType != "" && tenureType == "position") {
|
||||||
|
tenureTypeCondition = "registryEmployee.Years BETWEEN :tenureMin AND :tenureMax";
|
||||||
|
} else if (tenureType != "" && tenureType == "level") {
|
||||||
|
tenureTypeCondition = "registryEmployee.levelYears BETWEEN :tenureMin AND :tenureMax";
|
||||||
|
}
|
||||||
|
|
||||||
let retireLawCondition = "1=1";
|
let retireLawCondition = "1=1";
|
||||||
if (isRetireLaw) {
|
if (isRetireLaw) {
|
||||||
retireLawCondition =
|
retireLawCondition =
|
||||||
|
|
@ -624,6 +606,10 @@ export class ReportController extends Controller {
|
||||||
.where(nodeCondition, {
|
.where(nodeCondition, {
|
||||||
nodeId: nodeId,
|
nodeId: nodeId,
|
||||||
})
|
})
|
||||||
|
.andWhere(tenureTypeCondition, {
|
||||||
|
tenureMin: tenureMin,
|
||||||
|
tenureMax: tenureMax,
|
||||||
|
})
|
||||||
.andWhere("registryEmployee.age BETWEEN :ageMin AND :ageMax", {
|
.andWhere("registryEmployee.age BETWEEN :ageMin AND :ageMax", {
|
||||||
ageMin,
|
ageMin,
|
||||||
ageMax,
|
ageMax,
|
||||||
|
|
@ -683,67 +669,57 @@ export class ReportController extends Controller {
|
||||||
.orderBy(`registryEmployee.${sortBy}`, sort)
|
.orderBy(`registryEmployee.${sortBy}`, sort)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
||||||
const mapData = await Promise.all(lists.map(async(x) => {
|
const mapData = await Promise.all(
|
||||||
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [x.profileEmployeeId])
|
lists.map(async(x) => {
|
||||||
const _position = position.length > 0 ? position[0] : [];
|
return {
|
||||||
const lastPosition = _position.length > 0 ? _position[_position.length - 1] : null;
|
profileId: x.profileEmployeeId,
|
||||||
const mapPosition = lastPosition
|
citizenId: x.citizenId,
|
||||||
? [{
|
prefix: x.prefix,
|
||||||
Years: lastPosition.Years ? Math.floor(Number(lastPosition.Years)) : 0,
|
firstName: x.firstName,
|
||||||
Months: lastPosition.Months ? Math.floor(Number(lastPosition.Months)) : 0,
|
lastName: x.lastName,
|
||||||
Daysday: lastPosition.Days ? Math.floor(Number(lastPosition.Days)) : 0,
|
isProbation: x.isProbation,
|
||||||
}]
|
isLeave: x.isLeave,
|
||||||
: [];
|
isRetirement: x.isRetirement,
|
||||||
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [x.profileEmployeeId])
|
leaveType: x.leaveType,
|
||||||
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
|
posMasterNo: x.posMasterNo,
|
||||||
const lastPosLevel= _posLevel.length > 0 ? _posLevel[_posLevel.length - 1] : null;
|
orgRootId: x.orgRootId,
|
||||||
const mapPosLevel = lastPosLevel
|
orgChild1Id: x.orgChild1Id,
|
||||||
? [{
|
orgChild2Id: x.orgChild2Id,
|
||||||
Years: lastPosLevel.Years ? Math.floor(Number(lastPosLevel.Years)) : 0,
|
orgChild3Id: x.orgChild3Id,
|
||||||
Months: lastPosLevel.Months ? Math.floor(Number(lastPosLevel.Months)) : 0,
|
orgChild4Id: x.orgChild4Id,
|
||||||
Daysday: lastPosLevel.Days ? Math.floor(Number(lastPosLevel.Days)) : 0,
|
orgRootName: x.orgRootName,
|
||||||
}]
|
orgChild1Name: x.orgChild1Name,
|
||||||
: [];
|
orgChild2Name: x.orgChild2Name,
|
||||||
return {
|
orgChild3Name: x.orgChild3Name,
|
||||||
profileId: x.profileEmployeeId,
|
orgChild4Name: x.orgChild4Name,
|
||||||
citizenId: x.citizenId,
|
org: x.org,
|
||||||
prefix: x.prefix,
|
searchShortName: x.searchShortName,
|
||||||
firstName: x.firstName,
|
position: x.position,
|
||||||
lastName: x.lastName,
|
posTypeName: x.posTypeName,
|
||||||
isProbation: x.isProbation,
|
posLevelName: x.posLevelName,
|
||||||
isLeave: x.isLeave,
|
gender: x.gender,
|
||||||
isRetirement: x.isRetirement,
|
relationship: x.relationship,
|
||||||
leaveType: x.leaveType,
|
dateAppoint: x.dateAppoint,
|
||||||
posMasterNo: x.posMasterNo,
|
dateRetire: x.dateRetire,
|
||||||
orgRootId: x.orgRootId,
|
dateRetireLaw: x.dateRetireLaw,
|
||||||
orgChild1Id: x.orgChild1Id,
|
birthdate: x.birthdate,
|
||||||
orgChild2Id: x.orgChild2Id,
|
degree: x.degree,
|
||||||
orgChild3Id: x.orgChild3Id,
|
age: x.age,
|
||||||
orgChild4Id: x.orgChild4Id,
|
currentPosition: null,
|
||||||
orgRootName: x.orgRootName,
|
lengthPosition: null,
|
||||||
orgChild1Name: x.orgChild1Name,
|
positionDate: {
|
||||||
orgChild2Name: x.orgChild2Name,
|
Years: x.Years,
|
||||||
orgChild3Name: x.orgChild3Name,
|
Months: x.Months,
|
||||||
orgChild4Name: x.orgChild4Name,
|
Days: x.Days,
|
||||||
org: x.org,
|
},
|
||||||
searchShortName: x.searchShortName,
|
posLevelDate: {
|
||||||
position: x.position,
|
Years: x.levelYears,
|
||||||
posTypeName: x.posTypeName,
|
Months: x.levelMonths,
|
||||||
posLevelName: x.posLevelName,
|
Days: x.levelDays,
|
||||||
gender: x.gender,
|
},
|
||||||
relationship: x.relationship,
|
}
|
||||||
dateAppoint: x.dateAppoint,
|
|
||||||
dateRetire: x.dateRetire,
|
|
||||||
dateRetireLaw: x.dateRetireLaw,
|
|
||||||
birthdate: x.birthdate,
|
|
||||||
degree: x.degree,
|
|
||||||
age: x.age,
|
|
||||||
currentPosition: null,
|
|
||||||
lengthPosition: null,
|
|
||||||
positionDate: mapPosition,
|
|
||||||
posLevelDate: mapPosLevel
|
|
||||||
}
|
}
|
||||||
}));
|
));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
data: mapData,
|
data: mapData,
|
||||||
total: total,
|
total: total,
|
||||||
|
|
|
||||||
|
|
@ -224,4 +224,22 @@ export class viewRegistryEmployee {
|
||||||
|
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
age: number;
|
age: number;
|
||||||
|
|
||||||
|
@ViewColumn()
|
||||||
|
Years: number;
|
||||||
|
|
||||||
|
@ViewColumn()
|
||||||
|
Months: number;
|
||||||
|
|
||||||
|
@ViewColumn()
|
||||||
|
Days: number;
|
||||||
|
|
||||||
|
@ViewColumn()
|
||||||
|
levelYears: number;
|
||||||
|
|
||||||
|
@ViewColumn()
|
||||||
|
levelMonths: number;
|
||||||
|
|
||||||
|
@ViewColumn()
|
||||||
|
levelDays: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,15 +241,6 @@ export class viewRegistryOfficer {
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
Days: number;
|
Days: number;
|
||||||
|
|
||||||
@ViewColumn()
|
|
||||||
posExecutiveYears: number;
|
|
||||||
|
|
||||||
@ViewColumn()
|
|
||||||
posExecutiveMonths: number;
|
|
||||||
|
|
||||||
@ViewColumn()
|
|
||||||
posExecutiveDays: number;
|
|
||||||
|
|
||||||
@ViewColumn()
|
@ViewColumn()
|
||||||
levelYears: number;
|
levelYears: number;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue