This commit is contained in:
Warunee Tamkoo 2025-03-05 23:21:52 +07:00
parent 053195690d
commit 09826cd9a9

View file

@ -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,
@ -378,18 +378,18 @@ export class ReportController extends Controller {
currentPosition: null,
lengthPosition: null,
positionDate: {
Years: x.Years,
Months: x.Months,
Days: x.Days,
Years: x.Years ? x.Years : 0,
Months: x.Months ? x.Months : 0,
Days: x.Days ? x.Days : 0,
},
posLevelDate: {
Years: x.levelYears,
Months: x.levelMonths,
Days: x.levelDays,
Years: x.levelYears ? x.levelYears : 0,
Months: x.levelMonths ? x.levelMonths : 0,
Days: x.levelDays ? x.levelDays : 0,
},
}
}
));
};
}),
);
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 ? x.Years : 0,
Months: x.Months ? x.Months : 0,
Days: x.Days ? x.Days : 0,
},
posLevelDate: {
Years: x.levelYears ? x.levelYears : 0,
Months: x.levelMonths ? x.levelMonths : 0,
Days: x.levelDays ? x.levelDays : 0,
},
};
}),
);
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 } });
}
/**