เหตุผล kpi
This commit is contained in:
parent
ae87b678d1
commit
047ebd5bb1
5 changed files with 196 additions and 28 deletions
|
|
@ -80,7 +80,7 @@ export class kpiReasonController extends Controller {
|
|||
|
||||
let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonPlan(), requestBody);
|
||||
kpiUserEvaluationReason.type = type.trim().toUpperCase();
|
||||
if (type.trim().toUpperCase() == "PROBLEM") {
|
||||
if (type.trim().toUpperCase() == "PROGRESS") {
|
||||
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonPlan.findOne({
|
||||
where: { id: id },
|
||||
relations: ["kpiUserPlanned", "kpiUserPlanned.kpiUserEvaluation"],
|
||||
|
|
@ -267,7 +267,7 @@ export class kpiReasonController extends Controller {
|
|||
});
|
||||
let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonRole(), requestBody);
|
||||
kpiUserEvaluationReason.type = type.trim().toUpperCase();
|
||||
if (type.trim().toUpperCase() == "PROBLEM") {
|
||||
if (type.trim().toUpperCase() == "PROGRESS") {
|
||||
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRole.findOne({
|
||||
where: { id: id },
|
||||
relations: ["kpiUserRole", "kpiUserRole.kpiUserEvaluation"],
|
||||
|
|
@ -458,7 +458,7 @@ export class kpiReasonController extends Controller {
|
|||
requestBody,
|
||||
);
|
||||
kpiUserEvaluationReason.type = type.trim().toUpperCase();
|
||||
if (type.trim().toUpperCase() == "PROBLEM") {
|
||||
if (type.trim().toUpperCase() == "PROGRESS") {
|
||||
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonSpecial.findOne({
|
||||
where: { id: id },
|
||||
relations: ["kpiUserSpecial", "kpiUserSpecial.kpiUserEvaluation"],
|
||||
|
|
@ -648,7 +648,7 @@ export class kpiReasonController extends Controller {
|
|||
requestBody,
|
||||
);
|
||||
kpiUserEvaluationReason.type = type.trim().toUpperCase();
|
||||
if (type.trim().toUpperCase() == "PROBLEM") {
|
||||
if (type.trim().toUpperCase() == "PROGRESS") {
|
||||
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonDevelopment.findOne({
|
||||
where: { id: id },
|
||||
relations: ["kpiUserDevelopment", "kpiUserDevelopment.kpiUserEvaluation"],
|
||||
|
|
@ -842,7 +842,7 @@ export class kpiReasonController extends Controller {
|
|||
requestBody,
|
||||
);
|
||||
kpiUserEvaluationReason.type = type.trim().toUpperCase();
|
||||
if (type.trim().toUpperCase() == "PROBLEM") {
|
||||
if (type.trim().toUpperCase() == "PROGRESS") {
|
||||
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonCapacity.findOne({
|
||||
where: { id: id },
|
||||
relations: ["kpiUserCapacity", "kpiUserCapacity.kpiUserEvaluation"],
|
||||
|
|
|
|||
|
|
@ -100,19 +100,24 @@ export class KpiUserEvaluationController extends Controller {
|
|||
requestBody.status != null && requestBody.status != undefined
|
||||
? requestBody.status.trim().toUpperCase() == "NEW"
|
||||
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "NEW_EVALUATOR" WHEN commanderId = "${profileId}" THEN "NEW_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "NEW_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END`
|
||||
: requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR"
|
||||
? requestBody.evaluating == null || requestBody.evaluating == undefined
|
||||
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "EVALUATING_EVALUATOR" WHEN commanderId = "${profileId}" THEN "EVALUATING_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "EVALUATING_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END`
|
||||
: requestBody.evaluating == true
|
||||
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "EVALUATING_EVALUATOR" ELSE "${requestBody.status.trim().toUpperCase()}" END`
|
||||
: `evaluationStatus LIKE CASE WHEN commanderId = "${profileId}" THEN "EVALUATING_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "EVALUATING_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END`
|
||||
: "evaluationStatus LIKE :status"
|
||||
: requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR" ||
|
||||
requestBody.status.trim().toUpperCase() == "EVALUATING"
|
||||
? "evaluationStatus LIKE :status"
|
||||
: requestBody.status.trim().toUpperCase() == "SUMMARY"
|
||||
? "evaluationStatus LIKE :status"
|
||||
: "evaluationStatus LIKE :status"
|
||||
: "1=1",
|
||||
{
|
||||
status:
|
||||
requestBody.status == null || requestBody.status == undefined
|
||||
? null
|
||||
: requestBody.status.trim().toUpperCase(),
|
||||
: requestBody.status.trim().toUpperCase() == "EVALUATING" ||
|
||||
requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR" ||
|
||||
requestBody.status.trim().toUpperCase() == "SUMMARY"
|
||||
? requestBody.status.trim().toUpperCase() == "SUMMARY"
|
||||
? `%${requestBody.status.trim().toUpperCase()}%`
|
||||
: `%EVALUATING%`
|
||||
: requestBody.status.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
|
|
@ -415,7 +420,13 @@ export class KpiUserEvaluationController extends Controller {
|
|||
levelForGourp = "2";
|
||||
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ปฏิบัติงาน")
|
||||
levelForGourp = "1";
|
||||
kpiUserEvaluation.weightPoint1 = 80;
|
||||
kpiUserEvaluation.weightPoint2 = 20;
|
||||
kpiUserEvaluation.summaryWeight = 100;
|
||||
if (findPosition && findPosition.kpiLinkId && levelForGourp != null) {
|
||||
kpiUserEvaluation.weightPoint1 = 70;
|
||||
kpiUserEvaluation.weightPoint2 = 30;
|
||||
kpiUserEvaluation.summaryWeight = 100;
|
||||
const findKpiLink = await this.kpiLinkRepository.findOne({
|
||||
relations: ["kpiCapacitys"],
|
||||
where: {
|
||||
|
|
@ -493,6 +504,22 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
|
||||
if (requestBody.summaryPoint != null) {
|
||||
if (requestBody.summaryPoint >= 90) {
|
||||
kpiUserEvaluation.evaluationResults = "EXCELLENT";
|
||||
} else if (requestBody.summaryPoint >= 80) {
|
||||
kpiUserEvaluation.evaluationResults = "VERY_GOOD";
|
||||
} else if (requestBody.summaryPoint >= 70) {
|
||||
kpiUserEvaluation.evaluationResults = "GOOD";
|
||||
} else if (requestBody.summaryPoint >= 60) {
|
||||
kpiUserEvaluation.evaluationResults = "FAIR";
|
||||
} else {
|
||||
kpiUserEvaluation.evaluationResults = "IMPROVEMENT";
|
||||
}
|
||||
} else {
|
||||
kpiUserEvaluation.evaluationResults = "IMPROVEMENT";
|
||||
}
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
Object.assign(kpiUserEvaluation, requestBody);
|
||||
|
|
@ -663,11 +690,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
evaluatorId: kpiUserEvaluation.evaluatorId,
|
||||
commanderId: kpiUserEvaluation.commanderId,
|
||||
commanderHighId: kpiUserEvaluation.commanderHighId,
|
||||
plannedPoint: kpiUserEvaluation.plannedPoint,
|
||||
rolePoint: kpiUserEvaluation.rolePoint,
|
||||
specialPoint: kpiUserEvaluation.specialPoint,
|
||||
capacityPoint: kpiUserEvaluation.capacityPoint,
|
||||
// plannedPoint: kpiUserEvaluation.plannedPoint,
|
||||
// rolePoint: kpiUserEvaluation.rolePoint,
|
||||
// specialPoint: kpiUserEvaluation.specialPoint,
|
||||
// capacityPoint: kpiUserEvaluation.capacityPoint,
|
||||
kpiPeriodId: kpiUserEvaluation.kpiPeriodId,
|
||||
totalPoint1: kpiUserEvaluation.totalPoint1,
|
||||
totalPoint2_1: kpiUserEvaluation.totalPoint2_1,
|
||||
totalPoint2_2: kpiUserEvaluation.totalPoint2_2,
|
||||
summaryPoint: kpiUserEvaluation.summaryPoint,
|
||||
year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year,
|
||||
durationKPI:
|
||||
kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI,
|
||||
|
|
@ -960,7 +991,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
if (role == "EVALUATOR") {
|
||||
if (item.evaluationStatus == "EVALUATING_EVALUATOR") {
|
||||
if (item.commanderId == null || item.commanderId == "") {
|
||||
item.evaluationStatus = "COMPLETE";
|
||||
item.evaluationStatus = "SUMMARY";
|
||||
} else {
|
||||
item.evaluationStatus = "EVALUATING_COMMANDER";
|
||||
}
|
||||
|
|
@ -969,13 +1000,13 @@ export class KpiUserEvaluationController extends Controller {
|
|||
} else if (role == "COMMANDER") {
|
||||
if (item.evaluationStatus == "EVALUATING_COMMANDER") {
|
||||
if (item.commanderHighId == null || item.commanderHighId == "") {
|
||||
item.evaluationStatus = "COMPLETE";
|
||||
item.evaluationStatus = "SUMMARY";
|
||||
} else {
|
||||
item.evaluationStatus = "EVALUATING_COMMANDER_HIGH";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.evaluationStatus = "COMPLETE";
|
||||
item.evaluationStatus = "SUMMARY";
|
||||
}
|
||||
// } else {
|
||||
// // item.evaluationStatus = requestBody.status.trim().toUpperCase();
|
||||
|
|
@ -1043,6 +1074,24 @@ export class KpiUserEvaluationController extends Controller {
|
|||
);
|
||||
}
|
||||
const _null: any = null;
|
||||
if (kpiUserEvaluation.commanderId == null) {
|
||||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/profile/assessments", {
|
||||
date: new Date(),
|
||||
name: null,
|
||||
point1: null,
|
||||
point1Total: kpiUserEvaluation.totalPoint1,
|
||||
point2: null,
|
||||
point2Total: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
|
||||
pointSum: null,
|
||||
pointSumTotal: kpiUserEvaluation.summaryPoint,
|
||||
profileId: kpiUserEvaluation.profileId,
|
||||
})
|
||||
.then(async (x) => {});
|
||||
} else {
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER";
|
||||
}
|
||||
kpiUserEvaluation.topicEvaluator =
|
||||
requestBody.topicEvaluator == null ? _null : requestBody.topicEvaluator;
|
||||
kpiUserEvaluation.developEvaluator =
|
||||
|
|
@ -1084,6 +1133,24 @@ export class KpiUserEvaluationController extends Controller {
|
|||
);
|
||||
}
|
||||
const _null: any = null;
|
||||
if (kpiUserEvaluation.commanderHighId == null) {
|
||||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/profile/assessments", {
|
||||
date: new Date(),
|
||||
name: null,
|
||||
point1: null,
|
||||
point1Total: kpiUserEvaluation.totalPoint1,
|
||||
point2: null,
|
||||
point2Total: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
|
||||
pointSum: null,
|
||||
pointSumTotal: kpiUserEvaluation.summaryPoint,
|
||||
profileId: kpiUserEvaluation.profileId,
|
||||
})
|
||||
.then(async (x) => {});
|
||||
} else {
|
||||
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER_HIGH";
|
||||
}
|
||||
kpiUserEvaluation.isReasonCommander = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommander = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
|
|
@ -1119,6 +1186,20 @@ export class KpiUserEvaluationController extends Controller {
|
|||
);
|
||||
}
|
||||
const _null: any = null;
|
||||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/profile/assessments", {
|
||||
date: new Date(),
|
||||
name: null,
|
||||
point1: null,
|
||||
point1Total: kpiUserEvaluation.totalPoint1,
|
||||
point2: null,
|
||||
point2Total: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
|
||||
pointSum: null,
|
||||
pointSumTotal: kpiUserEvaluation.summaryPoint,
|
||||
profileId: kpiUserEvaluation.profileId,
|
||||
})
|
||||
.then(async (x) => {});
|
||||
kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason;
|
||||
kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
|
|
@ -1150,6 +1231,23 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"reasonCommander",
|
||||
"isReasonCommanderHigh",
|
||||
"reasonCommanderHigh",
|
||||
|
||||
"plannedPoint",
|
||||
"rolePoint",
|
||||
"specialPoint",
|
||||
"capacityPoint",
|
||||
|
||||
"totalPoint1",
|
||||
"totalPoint2_1",
|
||||
"totalPoint2_2",
|
||||
"summaryPoint",
|
||||
|
||||
"weightPoint1",
|
||||
"weightPoint2",
|
||||
"summaryWeight",
|
||||
|
||||
"evaluationResults",
|
||||
|
||||
"isOpen",
|
||||
],
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue