no message
This commit is contained in:
parent
19703a4f0b
commit
f0af5a5c83
4 changed files with 81 additions and 89 deletions
|
|
@ -187,9 +187,9 @@ export class kpiCapacityController extends Controller {
|
|||
@Get("head")
|
||||
async GetKpiCapacityTypeHEAD() {
|
||||
const kpiCapacity = await this.kpiCapacityRepository.find({
|
||||
where: {
|
||||
type: In(["HEAD"]),
|
||||
kpiCapacityDetails: { level: "1" }
|
||||
where: {
|
||||
type: In(["HEAD"]),
|
||||
kpiCapacityDetails: { level: "1" },
|
||||
},
|
||||
select: ["id", "name"],
|
||||
relations: ["kpiCapacityDetails"],
|
||||
|
|
@ -199,7 +199,7 @@ export class kpiCapacityController extends Controller {
|
|||
id: x.id,
|
||||
name: x.name,
|
||||
level: x.kpiCapacityDetails.length > 0 ? x.kpiCapacityDetails[0].level : null,
|
||||
description: x.kpiCapacityDetails.length > 0 ? x.kpiCapacityDetails[0].description : null,
|
||||
description: x.kpiCapacityDetails.length > 0 ? x.kpiCapacityDetails[0].description : null,
|
||||
}));
|
||||
|
||||
return new HttpSuccess(mapData);
|
||||
|
|
@ -212,34 +212,34 @@ export class kpiCapacityController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("group")
|
||||
async GetKpiCapacityTypeGROUP(
|
||||
@Query("positionName") positionName: string
|
||||
) {
|
||||
|
||||
async GetKpiCapacityTypeGROUP(@Query("positionName") positionName: string) {
|
||||
let position = await this.positionRepository.findOne({
|
||||
where: { name: Like(`%${positionName}%`) },
|
||||
relations: ["kpiLink.kpiCapacitys"]
|
||||
})
|
||||
|
||||
where: { name: Like(`${positionName}`) },
|
||||
relations: ["kpiLink", "kpiLink.kpiCapacitys"],
|
||||
});
|
||||
|
||||
if (position == null) {
|
||||
position = await this.positionRepository.findOne({
|
||||
position = await this.positionRepository.findOne({
|
||||
where: { name: "นักจัดการงานทั่วไป" },
|
||||
relations: ["kpiLink.kpiCapacitys"]
|
||||
})
|
||||
relations: ["kpiLink", "kpiLink.kpiCapacitys"],
|
||||
});
|
||||
}
|
||||
|
||||
let positionLinkId: any
|
||||
positionLinkId = position != null ? position : null
|
||||
const kpiCapacityIds = positionLinkId.kpiLink.kpiCapacitys.map((kpiCapacity:any) => kpiCapacity.id)
|
||||
let positionLinkId: any;
|
||||
positionLinkId = position != null ? position : null;
|
||||
if (positionLinkId == null || positionLinkId.kpiLink == null) return new HttpSuccess([]);
|
||||
const kpiCapacityIds = positionLinkId.kpiLink.kpiCapacitys.map(
|
||||
(kpiCapacity: any) => kpiCapacity.id,
|
||||
);
|
||||
|
||||
const kpiCapacity = await this.kpiCapacityRepository.find({
|
||||
where: {
|
||||
where: {
|
||||
id: In(kpiCapacityIds),
|
||||
type: In(["GROUP"]),
|
||||
kpiCapacityDetails: { level: "2" }
|
||||
type: In(["GROUP"]),
|
||||
kpiCapacityDetails: { level: "2" },
|
||||
},
|
||||
select: ["id", "name"],
|
||||
relations: ["kpiCapacityDetails",],
|
||||
relations: ["kpiCapacityDetails"],
|
||||
});
|
||||
|
||||
const mapData = kpiCapacity.map((x) => ({
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export class kpiPlanController extends Controller {
|
|||
}
|
||||
}
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/find/all", {
|
||||
.PostData(request, "/org/find/all", {
|
||||
node: requestBody.node,
|
||||
nodeId: requestBody.nodeId,
|
||||
})
|
||||
|
|
@ -82,7 +82,7 @@ export class kpiPlanController extends Controller {
|
|||
})
|
||||
.catch((x) => {});
|
||||
await new CallAPI()
|
||||
.PostData(request, "development/strategy/find/all", {
|
||||
.PostData(request, "/development/strategy/find/all", {
|
||||
strategy: requestBody.strategy,
|
||||
strategyId: requestBody.strategyId,
|
||||
})
|
||||
|
|
@ -221,7 +221,7 @@ export class kpiPlanController extends Controller {
|
|||
}
|
||||
Object.assign(kpiPlan, requestBody);
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/find/all", {
|
||||
.PostData(request, "/org/find/all", {
|
||||
node: requestBody.node,
|
||||
nodeId: requestBody.nodeId,
|
||||
})
|
||||
|
|
@ -244,7 +244,7 @@ export class kpiPlanController extends Controller {
|
|||
})
|
||||
.catch((x) => {});
|
||||
await new CallAPI()
|
||||
.PostData(request, "development/strategy/find/all", {
|
||||
.PostData(request, "/development/strategy/find/all", {
|
||||
strategy: requestBody.strategy,
|
||||
strategyId: requestBody.strategyId,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export class kpiRoleController extends Controller {
|
|||
}
|
||||
}
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/find/all", {
|
||||
.PostData(request, "/org/find/all", {
|
||||
node: requestBody.node,
|
||||
nodeId: requestBody.nodeId,
|
||||
})
|
||||
|
|
@ -218,7 +218,7 @@ export class kpiRoleController extends Controller {
|
|||
}
|
||||
Object.assign(kpiRole, requestBody);
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/find/all", {
|
||||
.PostData(request, "/org/find/all", {
|
||||
node: requestBody.node,
|
||||
nodeId: requestBody.nodeId,
|
||||
})
|
||||
|
|
@ -324,7 +324,6 @@ export class kpiRoleController extends Controller {
|
|||
orgRevisionId: kpiRole.orgRevisionId,
|
||||
position: kpiRole.position,
|
||||
documentInfoEvidence: kpiRole.documentInfoEvidence,
|
||||
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
}
|
||||
|
|
@ -414,36 +413,29 @@ export class kpiRoleController extends Controller {
|
|||
// period: `%${requestBody.period}%`,
|
||||
// },
|
||||
// )
|
||||
.andWhere(
|
||||
requestBody.year
|
||||
? "kpiRole.year LIKE :year"
|
||||
: "1=1",
|
||||
{
|
||||
year: `%${requestBody.year}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
requestBody.period
|
||||
? "kpiRole.period LIKE :period"
|
||||
: "1=1",
|
||||
{
|
||||
period: `%${requestBody.period}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(requestBody.year ? "kpiRole.year LIKE :year" : "1=1", {
|
||||
year: `%${requestBody.year}%`,
|
||||
})
|
||||
.andWhere(requestBody.period ? "kpiRole.period LIKE :period" : "1=1", {
|
||||
period: `%${requestBody.period}%`,
|
||||
})
|
||||
.andWhere(requestBody.position != undefined ? "kpiRole.position LIKE :position" : "1=1", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("kpiRole.including LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
}).orWhere("kpiRole.includingName LIKE :keyword",{
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
}).orWhere("kpiRole.year LIKE :keyword",{
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
}).orWhere("kpiRole.period LIKE :keyword",{
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
});
|
||||
qb.orWhere("kpiRole.including LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiRole.includingName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiRole.year LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiRole.period LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
});
|
||||
}),
|
||||
)
|
||||
.select([
|
||||
|
|
@ -552,21 +544,21 @@ export class kpiRoleController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API ประวัดิตัวชี้วัดตามตำแหน่ง
|
||||
* @param id Guid, *Id ประวัดิตัวชี้วัดตามตำแหน่ง
|
||||
*/
|
||||
@Get("history/{id}")
|
||||
async GetHistory(@Path() id: string) {
|
||||
const kpiRoleHistory = await this.kpiRoleHistoryRepository.find({
|
||||
where: { kpiRoleId: id },
|
||||
order:{
|
||||
createdAt: "ASC"
|
||||
}
|
||||
});
|
||||
if (!kpiRoleHistory) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประวัดิตัวชี้วัดตามตำแหน่งนี้");
|
||||
}
|
||||
return new HttpSuccess(kpiRoleHistory);
|
||||
}
|
||||
@Get("history/{id}")
|
||||
async GetHistory(@Path() id: string) {
|
||||
const kpiRoleHistory = await this.kpiRoleHistoryRepository.find({
|
||||
where: { kpiRoleId: id },
|
||||
order: {
|
||||
createdAt: "ASC",
|
||||
},
|
||||
});
|
||||
if (!kpiRoleHistory) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประวัดิตัวชี้วัดตามตำแหน่งนี้");
|
||||
}
|
||||
return new HttpSuccess(kpiRoleHistory);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.GetData(request, "/org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
|
|
@ -300,7 +300,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const kpiUserEvaluation = Object.assign(new KpiUserEvaluation(), requestBody);
|
||||
if (requestBody.profileId != undefined && requestBody.profileId != null) {
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/profileid/position/" + requestBody.profileId)
|
||||
.GetData(request, "/org/profile/profileid/position/" + requestBody.profileId)
|
||||
.then((x) => {
|
||||
kpiUserEvaluation.profileId = x.profileId;
|
||||
kpiUserEvaluation.prefix = x.prefix;
|
||||
|
|
@ -326,7 +326,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
});
|
||||
} else {
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.GetData(request, "/org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
kpiUserEvaluation.profileId = x.profileId;
|
||||
kpiUserEvaluation.prefix = x.prefix;
|
||||
|
|
@ -352,7 +352,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
});
|
||||
}
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/profileid/position/" + requestBody.evaluatorId)
|
||||
.GetData(request, "/org/profile/profileid/position/" + requestBody.evaluatorId)
|
||||
.then((x) => {
|
||||
kpiUserEvaluation.prefixEvaluator = x.prefix;
|
||||
kpiUserEvaluation.firstNameEvaluator = x.firstName;
|
||||
|
|
@ -418,7 +418,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
level = "1";
|
||||
for (const capacity of mainCapacities) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "kpi/user/capacity", {
|
||||
.PostData(request, "/kpi/user/capacity", {
|
||||
kpiUserEvaluationId: kpiUserEvaluation.id,
|
||||
kpiCapacityId: capacity.id,
|
||||
level: level,
|
||||
|
|
@ -479,7 +479,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
let groupCapacity = findKpiLink.kpiCapacitys;
|
||||
for (const capacity of groupCapacity) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "kpi/user/capacity", {
|
||||
.PostData(request, "/kpi/user/capacity", {
|
||||
kpiUserEvaluationId: kpiUserEvaluation.id,
|
||||
kpiCapacityId: capacity.id,
|
||||
level: levelForGourp,
|
||||
|
|
@ -692,7 +692,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
}
|
||||
if (requestBody.status.trim().toUpperCase() == "NEW_EVALUATOR") {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ส่งข้อตกลงการประเมินผลการปฏิบัติราชการระดับบุคคลให้อนุมัติ`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ส่งข้อตกลงการประเมินผลการปฏิบัติราชการระดับบุคคลให้อนุมัติ`,
|
||||
receiverUserId: kpiUserEvaluation.evaluatorId,
|
||||
|
|
@ -705,7 +705,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.catch((x) => {});
|
||||
} else if (requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR") {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} สรุปการประเมินผลการปฏิบัติราชการระดับบุคคล`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} สรุปการประเมินผลการปฏิบัติราชการระดับบุคคล`,
|
||||
receiverUserId: kpiUserEvaluation.evaluatorId,
|
||||
|
|
@ -795,7 +795,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.GetData(request, "/org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
|
|
@ -884,7 +884,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.GetData(request, "/org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
|
|
@ -918,7 +918,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
item.evaluationStatus = "APPROVE";
|
||||
} else {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${item.prefix}${item.firstName} ${item.lastName} ผู้ประเมินอนุมัติข้อตกลง`,
|
||||
body: `${item.prefix}${item.firstName} ${item.lastName} ผู้ประเมินอนุมัติข้อตกลง`,
|
||||
receiverUserId: item.commanderId,
|
||||
|
|
@ -938,7 +938,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
item.evaluationStatus = "APPROVE";
|
||||
} else {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${item.prefix}${item.firstName} ${item.lastName} ผู้บังคับบัญชาเหนือขึ้นไปอนุมัติข้อตกลง`,
|
||||
body: `${item.prefix}${item.firstName} ${item.lastName} ผู้บังคับบัญชาเหนือขึ้นไปอนุมัติข้อตกลง`,
|
||||
receiverUserId: item.commanderHighId,
|
||||
|
|
@ -984,7 +984,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.GetData(request, "/org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
|
|
@ -1065,7 +1065,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.GetData(request, "/org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
|
|
@ -1183,7 +1183,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const _null: any = null;
|
||||
if (kpiUserEvaluation.commanderId == null) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/keycloak", {
|
||||
.PostData(request, "/placement/noti/keycloak", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
receiverUserId: "aec26ac3-417c-4cf9-9cbe-874939f99ecc",
|
||||
|
|
@ -1197,7 +1197,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
} else {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
receiverUserId: kpiUserEvaluation.commanderId,
|
||||
|
|
@ -1253,7 +1253,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const _null: any = null;
|
||||
if (kpiUserEvaluation.commanderHighId == null) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/keycloak", {
|
||||
.PostData(request, "/placement/noti/keycloak", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
receiverUserId: "aec26ac3-417c-4cf9-9cbe-874939f99ecc",
|
||||
|
|
@ -1267,7 +1267,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
} else {
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
receiverUserId: kpiUserEvaluation.commanderHighId,
|
||||
|
|
@ -1317,7 +1317,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const _null: any = null;
|
||||
kpiUserEvaluation.evaluationStatus = "COMPLETE";
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/keycloak", {
|
||||
.PostData(request, "/placement/noti/keycloak", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
|
||||
receiverUserId: "aec26ac3-417c-4cf9-9cbe-874939f99ecc",
|
||||
|
|
@ -1358,7 +1358,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluations.map(async (kpiUserEvaluation) => {
|
||||
kpiUserEvaluation.evaluationStatus = "KP7";
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/profile/assessments", {
|
||||
.PostData(request, "/org/profile/assessments", {
|
||||
date: new Date(),
|
||||
name: kpiUserEvaluation.evaluationResults,
|
||||
point1Total: kpiUserEvaluation.weightPoint1,
|
||||
|
|
@ -1371,7 +1371,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
})
|
||||
.then(async (x) => {});
|
||||
await new CallAPI()
|
||||
.PostData(request, "placement/noti/profile", {
|
||||
.PostData(request, "/placement/noti/profile", {
|
||||
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ระดับผลการประเมินการปฏิบัติราชการระดับบุคคลของคุณอยู่ในเกณฑ์ ${kpiUserEvaluation.summaryPoint}`,
|
||||
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ระดับผลการประเมินการปฏิบัติราชการระดับบุคคลของคุณอยู่ในเกณฑ์ ${kpiUserEvaluation.summaryPoint}`,
|
||||
receiverUserId: kpiUserEvaluation.profileId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue