แสดง isentry
This commit is contained in:
parent
053195690d
commit
b80ed12f8e
2 changed files with 208 additions and 208 deletions
|
|
@ -39,7 +39,7 @@ export class ProfileSalaryController extends Controller {
|
|||
private positionEmployeeRepo = AppDataSource.getRepository(TenurePositionEmployee);
|
||||
private levelOfficerRepo = AppDataSource.getRepository(TenureLevelOfficer);
|
||||
private levelEmployeeRepo = AppDataSource.getRepository(TenureLevelEmployee);
|
||||
|
||||
|
||||
@Get("TenurePositionOfficer")
|
||||
public async cronjobTenurePositionOfficer() {
|
||||
let data: any = [];
|
||||
|
|
@ -47,39 +47,38 @@ export class ProfileSalaryController extends Controller {
|
|||
await this.positionOfficerRepo.remove(positionOfficer);
|
||||
const profile = await this.profileRepo.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 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 = {
|
||||
profileId: 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.positionOfficerRepo.save(mapData);
|
||||
}
|
||||
// await this.positionOfficerRepo.save(data);
|
||||
|
||||
: [];
|
||||
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 = {
|
||||
profileId: 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.positionOfficerRepo.save(mapData);
|
||||
}
|
||||
// await this.positionOfficerRepo.save(data);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
@Get("TenurePositionEmployee")
|
||||
|
|
@ -89,39 +88,38 @@ export class ProfileSalaryController extends Controller {
|
|||
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 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);
|
||||
|
||||
: [];
|
||||
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")
|
||||
|
|
@ -129,47 +127,46 @@ export class ProfileSalaryController extends Controller {
|
|||
let data: any = [];
|
||||
const positionOfficer = await this.levelOfficerRepo.find();
|
||||
await this.levelOfficerRepo.remove(positionOfficer);
|
||||
const profile = await this.profileRepo.find({relations:["posLevel"]});
|
||||
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 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);
|
||||
|
||||
: [];
|
||||
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")
|
||||
|
|
@ -177,47 +174,46 @@ export class ProfileSalaryController extends Controller {
|
|||
let data: any = [];
|
||||
const positionEmployee = await this.levelEmployeeRepo.find();
|
||||
await this.levelEmployeeRepo.remove(positionEmployee);
|
||||
const profile = await this.profileEmployeeRepo.find({relations:["posLevel"]});
|
||||
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 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);
|
||||
|
||||
: [];
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -258,9 +254,11 @@ export class ProfileSalaryController extends Controller {
|
|||
"14",
|
||||
"15",
|
||||
"16",
|
||||
null,
|
||||
]),
|
||||
},
|
||||
order: { order: "ASC" },
|
||||
// order: { order: "ASC" },
|
||||
order: { commandDateAffect: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
|
@ -300,9 +298,11 @@ export class ProfileSalaryController extends Controller {
|
|||
"14",
|
||||
"15",
|
||||
"16",
|
||||
null,
|
||||
]),
|
||||
},
|
||||
order: { order: "ASC" },
|
||||
// order: { order: "ASC" },
|
||||
order: { commandDateAffect: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ export class ReportController extends Controller {
|
|||
.getManyAndCount();
|
||||
|
||||
const mapData = await Promise.all(
|
||||
lists.map(async(x) => {
|
||||
lists.map(async (x) => {
|
||||
return {
|
||||
profileId: x.profileId,
|
||||
citizenId: x.citizenId,
|
||||
|
|
@ -382,14 +382,14 @@ export class ReportController extends Controller {
|
|||
Months: x.Months,
|
||||
Days: x.Days,
|
||||
},
|
||||
posLevelDate: {
|
||||
Years: x.levelYears,
|
||||
Months: x.levelMonths,
|
||||
Days: x.levelDays,
|
||||
levelDate: {
|
||||
posExecutiveYears: x.levelYears,
|
||||
posExecutiveMonths: x.levelMonths,
|
||||
posExecutiveDays: x.levelDays,
|
||||
},
|
||||
}
|
||||
}
|
||||
));
|
||||
};
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess({
|
||||
data: mapData,
|
||||
total: total,
|
||||
|
|
@ -669,57 +669,57 @@ export class ReportController extends Controller {
|
|||
.orderBy(`registryEmployee.${sortBy}`, sort)
|
||||
.getManyAndCount();
|
||||
|
||||
const mapData = await Promise.all(
|
||||
lists.map(async(x) => {
|
||||
return {
|
||||
profileId: x.profileEmployeeId,
|
||||
citizenId: x.citizenId,
|
||||
prefix: x.prefix,
|
||||
firstName: x.firstName,
|
||||
lastName: x.lastName,
|
||||
isProbation: x.isProbation,
|
||||
isLeave: x.isLeave,
|
||||
isRetirement: x.isRetirement,
|
||||
leaveType: x.leaveType,
|
||||
posMasterNo: x.posMasterNo,
|
||||
orgRootId: x.orgRootId,
|
||||
orgChild1Id: x.orgChild1Id,
|
||||
orgChild2Id: x.orgChild2Id,
|
||||
orgChild3Id: x.orgChild3Id,
|
||||
orgChild4Id: x.orgChild4Id,
|
||||
orgRootName: x.orgRootName,
|
||||
orgChild1Name: x.orgChild1Name,
|
||||
orgChild2Name: x.orgChild2Name,
|
||||
orgChild3Name: x.orgChild3Name,
|
||||
orgChild4Name: x.orgChild4Name,
|
||||
org: x.org,
|
||||
searchShortName: x.searchShortName,
|
||||
position: x.position,
|
||||
posTypeName: x.posTypeName,
|
||||
posLevelName: x.posLevelName,
|
||||
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,
|
||||
},
|
||||
posLevelDate: {
|
||||
Years: x.levelYears,
|
||||
Months: x.levelMonths,
|
||||
Days: x.levelDays,
|
||||
},
|
||||
}
|
||||
}
|
||||
));
|
||||
const mapData = await Promise.all(
|
||||
lists.map(async (x) => {
|
||||
return {
|
||||
profileId: x.profileEmployeeId,
|
||||
citizenId: x.citizenId,
|
||||
prefix: x.prefix,
|
||||
firstName: x.firstName,
|
||||
lastName: x.lastName,
|
||||
isProbation: x.isProbation,
|
||||
isLeave: x.isLeave,
|
||||
isRetirement: x.isRetirement,
|
||||
leaveType: x.leaveType,
|
||||
posMasterNo: x.posMasterNo,
|
||||
orgRootId: x.orgRootId,
|
||||
orgChild1Id: x.orgChild1Id,
|
||||
orgChild2Id: x.orgChild2Id,
|
||||
orgChild3Id: x.orgChild3Id,
|
||||
orgChild4Id: x.orgChild4Id,
|
||||
orgRootName: x.orgRootName,
|
||||
orgChild1Name: x.orgChild1Name,
|
||||
orgChild2Name: x.orgChild2Name,
|
||||
orgChild3Name: x.orgChild3Name,
|
||||
orgChild4Name: x.orgChild4Name,
|
||||
org: x.org,
|
||||
searchShortName: x.searchShortName,
|
||||
position: x.position,
|
||||
posTypeName: x.posTypeName,
|
||||
posLevelName: x.posLevelName,
|
||||
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,
|
||||
},
|
||||
levelDate: {
|
||||
posExecutiveYears: x.levelYears,
|
||||
posExecutiveMonths: x.levelMonths,
|
||||
posExecutiveDays: x.levelDays,
|
||||
},
|
||||
};
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess({
|
||||
data: mapData,
|
||||
total: total,
|
||||
|
|
@ -3541,11 +3541,11 @@ export class ReportController extends Controller {
|
|||
}
|
||||
}
|
||||
// console.log(">>",data);
|
||||
|
||||
|
||||
// wss.clients.forEach((client: any) => {
|
||||
// if (client.readyState === WebSocket.OPEN) {
|
||||
// const message = JSON.stringify({ template: "report2", reportName: "report2", data: { data } });
|
||||
// console.log("📤 Sending data to client:", message);
|
||||
// console.log("📤 Sending data to client:", message);
|
||||
// client.send(message, (err:any) => {
|
||||
// if (err) {
|
||||
// console.error("❌ Error sending message:", err);
|
||||
|
|
@ -3553,8 +3553,8 @@ export class ReportController extends Controller {
|
|||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
|
||||
|
||||
return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue