fix report kpi 8, 9
This commit is contained in:
parent
87d6a84bca
commit
5d4379416d
1 changed files with 40 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { Controller, Get, Post, Route, Security, Tags, Body, Path, Request } from "tsoa";
|
import { Controller, Get, Post, Route, Security, Tags, Body, Path, Request } from "tsoa";
|
||||||
import { AppDataSource } from "../database/data-source";
|
import { AppDataSource } from "../database/data-source";
|
||||||
import { In } from "typeorm";
|
import { In, Not } from "typeorm";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatusCode from "../interfaces/http-status";
|
import HttpStatusCode from "../interfaces/http-status";
|
||||||
|
|
@ -77,7 +77,7 @@ export class ReportController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
year: data.year,
|
year: data.year,
|
||||||
durationKPI: "OCT",
|
durationKPI: "OCT",
|
||||||
isActive: true,
|
// isActive: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
period2 = _period2
|
period2 = _period2
|
||||||
|
|
@ -89,7 +89,7 @@ export class ReportController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
year: data.year,
|
year: data.year,
|
||||||
durationKPI: "APR",
|
durationKPI: "APR",
|
||||||
isActive: true,
|
// isActive: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
period1 = _period1
|
period1 = _period1
|
||||||
|
|
@ -1284,7 +1284,7 @@ export class ReportController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
year: period_.year,
|
year: period_.year,
|
||||||
durationKPI: "OCT",
|
durationKPI: "OCT",
|
||||||
isActive: true,
|
// isActive: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
period2 = _period2
|
period2 = _period2
|
||||||
|
|
@ -1296,7 +1296,7 @@ export class ReportController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
year: period_.year,
|
year: period_.year,
|
||||||
durationKPI: "APR",
|
durationKPI: "APR",
|
||||||
isActive: true,
|
// isActive: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
period1 = _period1
|
period1 = _period1
|
||||||
|
|
@ -1395,12 +1395,45 @@ export class ReportController extends Controller {
|
||||||
posLevel: userInfo ? userInfo[0]?.posLevelName : "-",
|
posLevel: userInfo ? userInfo[0]?.posLevelName : "-",
|
||||||
period1: period1 ? Extension.ToThaiNumber(period1) : "-",
|
period1: period1 ? Extension.ToThaiNumber(period1) : "-",
|
||||||
period2: period2 ? Extension.ToThaiNumber(period2) : "-",
|
period2: period2 ? Extension.ToThaiNumber(period2) : "-",
|
||||||
developments: formattedUserDevelopmentLists ? formattedUserDevelopmentLists : [{}],
|
developments: formattedUserDevelopmentLists
|
||||||
|
? formattedUserDevelopmentLists
|
||||||
|
: [{
|
||||||
|
no:"-",
|
||||||
|
name:"-",
|
||||||
|
target:"-",
|
||||||
|
summary:"-"
|
||||||
|
}],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (requestBody.type == "KPI9") {
|
if (requestBody.type == "KPI9") {
|
||||||
templateName = "KPI9";
|
templateName = "KPI9";
|
||||||
reportName = "KPI9";
|
reportName = "KPI9";
|
||||||
|
if(data && data.kpiUserEvaluations.length == 0) {
|
||||||
|
//แก้ไขกรณีมีผู้ประเมินที่มีผลการประเมินดีเด่น แต่ RootId ไม่ตรงกับหน่วยงานที่ filter
|
||||||
|
let userEvaInRoot: any
|
||||||
|
let userEvaOutRoot: any []
|
||||||
|
userEvaInRoot = await this.kpiUserEvaluationRepository.findOne({
|
||||||
|
select: ["org"],
|
||||||
|
where: {
|
||||||
|
kpiPeriodId: String(requestBody.periodId),
|
||||||
|
orgId: String(requestBody.root),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if(userEvaInRoot) {
|
||||||
|
userEvaOutRoot = await this.kpiUserEvaluationRepository.find({
|
||||||
|
where: {
|
||||||
|
kpiPeriodId: String(requestBody.periodId),
|
||||||
|
orgId: Not(String(requestBody.root)),
|
||||||
|
org: userEvaInRoot.org,
|
||||||
|
evaluationStatus: "KP7",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if(userEvaOutRoot.length > 0) {
|
||||||
|
data.kpiUserEvaluations = userEvaOutRoot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const userEvaluations_ =
|
const userEvaluations_ =
|
||||||
data.kpiUserEvaluations.length > 0
|
data.kpiUserEvaluations.length > 0
|
||||||
? data.kpiUserEvaluations
|
? data.kpiUserEvaluations
|
||||||
|
|
@ -1426,6 +1459,7 @@ export class ReportController extends Controller {
|
||||||
posLevelName: "-",
|
posLevelName: "-",
|
||||||
evaluationResults: "-",
|
evaluationResults: "-",
|
||||||
}];
|
}];
|
||||||
|
|
||||||
formattedData = {
|
formattedData = {
|
||||||
root:
|
root:
|
||||||
data && data.rootName != null
|
data && data.rootName != null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue