ปรับออกคำสั่งลงตำแหน่ง
This commit is contained in:
parent
c5e0fcc4f7
commit
e305ea7a88
20 changed files with 1317 additions and 1183 deletions
|
|
@ -32,7 +32,9 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||
private profileAssessmentRepo = AppDataSource.getRepository(ProfileAssessment);
|
||||
private viewProfileEvaluationRepo = AppDataSource.getRepository(viewProfileEvaluation);
|
||||
private viewProfileEmployeeEvaluationRepo = AppDataSource.getRepository(viewProfileEmployeeEvaluation);
|
||||
private viewProfileEmployeeEvaluationRepo = AppDataSource.getRepository(
|
||||
viewProfileEmployeeEvaluation,
|
||||
);
|
||||
|
||||
/**
|
||||
* API รายชื่อราชการที่เลื่อนเงินเดือน (unauthorize)
|
||||
|
|
@ -1001,7 +1003,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -1080,7 +1082,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -1170,7 +1172,6 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
return new HttpSuccess("Email verified successfully.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API ผลการประเมิน 5 ปีย้อนหลังนับจากปีปัจจุบัน
|
||||
*
|
||||
|
|
@ -1208,80 +1209,102 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
// where:{
|
||||
// ...condition
|
||||
// }
|
||||
})
|
||||
if(conType == "EMPLOYEE"){
|
||||
lists = await this.viewProfileEmployeeEvaluationRepo.find({})
|
||||
});
|
||||
if (conType == "EMPLOYEE") {
|
||||
lists = await this.viewProfileEmployeeEvaluationRepo.find({});
|
||||
}
|
||||
const groupData: any = {};
|
||||
const groupData: any = {};
|
||||
const year = new Date().getFullYear();
|
||||
const years = [year, year - 1, year - 2, year - 3, year - 4];
|
||||
|
||||
|
||||
lists.forEach((item: any) => {
|
||||
if (!groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId]) {
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId] = {
|
||||
profileId: conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId,
|
||||
yearAPR1: "-", periodAPR1: "-", resultAPR1: "-",
|
||||
yearOCT1: "-", periodOCT1: "-", resultOCT1: "-",
|
||||
yearAPR2: "-", periodAPR2: "-", resultAPR2: "-",
|
||||
yearOCT2: "-", periodOCT2: "-", resultOCT2: "-",
|
||||
yearAPR3: "-", periodAPR3: "-", resultAPR3: "-",
|
||||
yearOCT3: "-", periodOCT3: "-", resultOCT3: "-",
|
||||
yearAPR4: "-", periodAPR4: "-", resultAPR4: "-",
|
||||
yearOCT4: "-", periodOCT4: "-", resultOCT4: "-",
|
||||
yearAPR5: "-", periodAPR5: "-", resultAPR5: "-",
|
||||
yearOCT5: "-", periodOCT5: "-", resultOCT5: "-"
|
||||
if (!groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId]) {
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId] = {
|
||||
profileId: conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId,
|
||||
yearAPR1: "-",
|
||||
periodAPR1: "-",
|
||||
resultAPR1: "-",
|
||||
yearOCT1: "-",
|
||||
periodOCT1: "-",
|
||||
resultOCT1: "-",
|
||||
yearAPR2: "-",
|
||||
periodAPR2: "-",
|
||||
resultAPR2: "-",
|
||||
yearOCT2: "-",
|
||||
periodOCT2: "-",
|
||||
resultOCT2: "-",
|
||||
yearAPR3: "-",
|
||||
periodAPR3: "-",
|
||||
resultAPR3: "-",
|
||||
yearOCT3: "-",
|
||||
periodOCT3: "-",
|
||||
resultOCT3: "-",
|
||||
yearAPR4: "-",
|
||||
periodAPR4: "-",
|
||||
resultAPR4: "-",
|
||||
yearOCT4: "-",
|
||||
periodOCT4: "-",
|
||||
resultOCT4: "-",
|
||||
yearAPR5: "-",
|
||||
periodAPR5: "-",
|
||||
resultAPR5: "-",
|
||||
yearOCT5: "-",
|
||||
periodOCT5: "-",
|
||||
resultOCT5: "-",
|
||||
};
|
||||
}
|
||||
const yearIndex = years.indexOf(parseInt(item.year));
|
||||
const yearIndex = years.indexOf(parseInt(item.year));
|
||||
if (yearIndex !== -1) {
|
||||
const yearSuffix = yearIndex + 1;
|
||||
const yearKey = `year${item.period}${yearSuffix}`;
|
||||
const periodKey = `period${item.period}${yearSuffix}`;
|
||||
const resultKey = `result${item.period}${yearSuffix}`;
|
||||
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId][yearKey] = item.year;
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId][periodKey] = item.period;
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId][resultKey] = item.result;
|
||||
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId][yearKey] =
|
||||
item.year;
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId][periodKey] =
|
||||
item.period;
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId][resultKey] =
|
||||
item.result;
|
||||
}
|
||||
});
|
||||
const formattedResults = Object.values(groupData).map((x: any) => ({
|
||||
profileId: x.profileId,
|
||||
yearAPR1: x.yearAPR1,
|
||||
periodAPR1: x.periodAPR1,
|
||||
resultAPR1: x.resultAPR1?Extension.textPoint(x.resultAPR1):"-",
|
||||
resultAPR1: x.resultAPR1 ? Extension.textPoint(x.resultAPR1) : "-",
|
||||
yearOCT1: x.yearOCT1,
|
||||
periodOCT1: x.periodOCT1,
|
||||
resultOCT1: x.resultOCT1?Extension.textPoint(x.resultOCT1):"-",
|
||||
resultOCT1: x.resultOCT1 ? Extension.textPoint(x.resultOCT1) : "-",
|
||||
yearAPR2: x.yearAPR2,
|
||||
periodAPR2: x.periodAPR2,
|
||||
resultAPR2: x.resultAPR2?Extension.textPoint(x.resultAPR2):"-",
|
||||
resultAPR2: x.resultAPR2 ? Extension.textPoint(x.resultAPR2) : "-",
|
||||
yearOCT2: x.yearOCT2,
|
||||
periodOCT2: x.periodOCT2,
|
||||
resultOCT2: x.resultOCT2?Extension.textPoint(x.resultOCT2):"-",
|
||||
resultOCT2: x.resultOCT2 ? Extension.textPoint(x.resultOCT2) : "-",
|
||||
yearAPR3: x.yearAPR3,
|
||||
periodAPR3: x.periodAPR3,
|
||||
resultAPR3: x.resultAPR3?Extension.textPoint(x.resultAPR3):"-",
|
||||
resultAPR3: x.resultAPR3 ? Extension.textPoint(x.resultAPR3) : "-",
|
||||
yearOCT3: x.yearOCT3,
|
||||
periodOCT3: x.periodOCT3,
|
||||
resultOCT3: x.resultOCT3?Extension.textPoint(x.resultOCT3):"-",
|
||||
resultOCT3: x.resultOCT3 ? Extension.textPoint(x.resultOCT3) : "-",
|
||||
yearAPR4: x.yearAPR4,
|
||||
periodAPR4: x.periodAPR4,
|
||||
resultAPR4: x.resultAPR4?Extension.textPoint(x.resultAPR4):"-",
|
||||
resultAPR4: x.resultAPR4 ? Extension.textPoint(x.resultAPR4) : "-",
|
||||
yearOCT4: x.yearOCT4,
|
||||
periodOCT4: x.periodOCT4,
|
||||
resultOCT4: x.resultOCT4?Extension.textPoint(x.resultOCT4):"-",
|
||||
resultOCT4: x.resultOCT4 ? Extension.textPoint(x.resultOCT4) : "-",
|
||||
yearAPR5: x.yearAPR5,
|
||||
periodAPR5: x.periodAPR5,
|
||||
resultAPR5: x.resultAPR5?Extension.textPoint(x.resultAPR5):"-",
|
||||
resultAPR5: x.resultAPR5 ? Extension.textPoint(x.resultAPR5) : "-",
|
||||
yearOCT5: x.yearOCT5,
|
||||
periodOCT5: x.periodOCT5,
|
||||
resultOCT5: x.resultOCT5?Extension.textPoint(x.resultOCT5):"-",
|
||||
resultOCT5: x.resultOCT5 ? Extension.textPoint(x.resultOCT5) : "-",
|
||||
}));
|
||||
|
||||
|
||||
return new HttpSuccess(formattedResults);
|
||||
}
|
||||
|
||||
|
||||
// @Patch("retirement")
|
||||
// public async updateStatusRetirement(
|
||||
// @Body()
|
||||
|
|
@ -1306,10 +1329,10 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
// profiles.push(_profile);
|
||||
// })
|
||||
// );
|
||||
// await this.profileRepo.save(profiles);
|
||||
// await this.profileRepo.save(profiles);
|
||||
// return new HttpSuccess();
|
||||
// }
|
||||
|
||||
|
||||
// @Patch("retirement-employee")
|
||||
// public async updateStatusRetirementEmp(
|
||||
// @Body()
|
||||
|
|
@ -1334,7 +1357,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
// profiles.push(_profile);
|
||||
// })
|
||||
// );
|
||||
// await this.profileEmpRepo.save(profiles);
|
||||
// await this.profileEmpRepo.save(profiles);
|
||||
// return new HttpSuccess();
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue