แก้ env

This commit is contained in:
Kittapath 2024-07-09 17:03:35 +07:00
parent 3e8175d2c5
commit 19703a4f0b
3 changed files with 123 additions and 39 deletions

View file

@ -9,8 +9,8 @@ env:
REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-kpi-service
DEPLOY_HOST: frappet.com
COMPOSE_PATH: /home/frappet/docker/bma-ehr
# COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-kpi
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-kpi
jobs:
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-test:

View file

@ -690,6 +690,33 @@ export class KpiUserEvaluationController extends Controller {
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
);
}
if (requestBody.status.trim().toUpperCase() == "NEW_EVALUATOR") {
await new CallAPI()
.PostData(request, "placement/noti/profile", {
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ส่งข้อตกลงการประเมินผลการปฏิบัติราชการระดับบุคคลให้อนุมัติ`,
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ส่งข้อตกลงการประเมินผลการปฏิบัติราชการระดับบุคคลให้อนุมัติ`,
receiverUserId: kpiUserEvaluation.evaluatorId,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
} else if (requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR") {
await new CallAPI()
.PostData(request, "placement/noti/profile", {
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} สรุปการประเมินผลการปฏิบัติราชการระดับบุคคล`,
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} สรุปการประเมินผลการปฏิบัติราชการระดับบุคคล`,
receiverUserId: kpiUserEvaluation.evaluatorId,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
}
kpiUserEvaluation.evaluationStatus = requestBody.status.trim().toUpperCase();
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
kpiUserEvaluation.lastUpdateFullName = request.user.name;
@ -890,6 +917,18 @@ export class KpiUserEvaluationController extends Controller {
if (item.commanderId == null || item.commanderId == "") {
item.evaluationStatus = "APPROVE";
} else {
await new CallAPI()
.PostData(request, "placement/noti/profile", {
subject: `${item.prefix}${item.firstName} ${item.lastName} ผู้ประเมินอนุมัติข้อตกลง`,
body: `${item.prefix}${item.firstName} ${item.lastName} ผู้ประเมินอนุมัติข้อตกลง`,
receiverUserId: item.commanderId,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
item.evaluationStatus = "NEW_COMMANDER";
}
}
@ -898,6 +937,18 @@ export class KpiUserEvaluationController extends Controller {
if (item.commanderHighId == null || item.commanderHighId == "") {
item.evaluationStatus = "APPROVE";
} else {
await new CallAPI()
.PostData(request, "placement/noti/profile", {
subject: `${item.prefix}${item.firstName} ${item.lastName} ผู้บังคับบัญชาเหนือขึ้นไปอนุมัติข้อตกลง`,
body: `${item.prefix}${item.firstName} ${item.lastName} ผู้บังคับบัญชาเหนือขึ้นไปอนุมัติข้อตกลง`,
receiverUserId: item.commanderHighId,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
item.evaluationStatus = "NEW_COMMANDER_HIGH";
}
}
@ -1131,21 +1182,32 @@ 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: kpiUserEvaluation.evaluationResults,
point1Total: kpiUserEvaluation.weightPoint1,
point1: kpiUserEvaluation.totalPoint1,
point2Total: kpiUserEvaluation.weightPoint2,
point2: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
pointSumTotal: kpiUserEvaluation.summaryWeight,
pointSum: kpiUserEvaluation.summaryPoint,
profileId: kpiUserEvaluation.profileId,
.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",
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then(async (x) => {});
.then((x) => {})
.catch((x) => {});
kpiUserEvaluation.evaluationStatus = "COMPLETE";
} else {
await new CallAPI()
.PostData(request, "placement/noti/profile", {
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
receiverUserId: kpiUserEvaluation.commanderId,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER";
}
kpiUserEvaluation.topicEvaluator =
@ -1190,21 +1252,32 @@ 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: kpiUserEvaluation.evaluationResults,
point1Total: kpiUserEvaluation.weightPoint1,
point1: kpiUserEvaluation.totalPoint1,
point2Total: kpiUserEvaluation.weightPoint2,
point2: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
pointSumTotal: kpiUserEvaluation.summaryWeight,
pointSum: kpiUserEvaluation.summaryPoint,
profileId: kpiUserEvaluation.profileId,
.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",
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then(async (x) => {});
.then((x) => {})
.catch((x) => {});
kpiUserEvaluation.evaluationStatus = "COMPLETE";
} else {
await new CallAPI()
.PostData(request, "placement/noti/profile", {
subject: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
body: `${kpiUserEvaluation.prefix}${kpiUserEvaluation.firstName} ${kpiUserEvaluation.lastName} ผู้ประเมินแสดงความเห็น`,
receiverUserId: kpiUserEvaluation.commanderHighId,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER_HIGH";
}
kpiUserEvaluation.isReasonCommander = requestBody.isReason;
@ -1244,18 +1317,17 @@ export class KpiUserEvaluationController extends Controller {
const _null: any = null;
kpiUserEvaluation.evaluationStatus = "COMPLETE";
await new CallAPI()
.PostData(request, "org/profile/assessments", {
date: new Date(),
name: kpiUserEvaluation.evaluationResults,
point1Total: kpiUserEvaluation.weightPoint1,
point1: kpiUserEvaluation.totalPoint1,
point2Total: kpiUserEvaluation.weightPoint2,
point2: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
pointSumTotal: kpiUserEvaluation.summaryWeight,
pointSum: kpiUserEvaluation.summaryPoint,
profileId: kpiUserEvaluation.profileId,
.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",
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then(async (x) => {});
.then((x) => {})
.catch((x) => {});
kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason;
kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason;
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
@ -1298,6 +1370,18 @@ export class KpiUserEvaluationController extends Controller {
profileId: kpiUserEvaluation.profileId,
})
.then(async (x) => {});
await new CallAPI()
.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,
payload: "",
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.then((x) => {})
.catch((x) => {});
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
kpiUserEvaluation.lastUpdateFullName = request.user.name;
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);

View file

@ -17,7 +17,7 @@ class CallAPI {
//Get
public async GetData(request: any, @Path() path: any) {
const token = request.headers.authorization;
const url = process.env.API + path;
const url = process.env.API_URL + path;
try {
const response = await axios.get(url, {
headers: {
@ -33,7 +33,7 @@ class CallAPI {
//Post
public async PostData(request: any, @Path() path: any, sendData: any) {
const token = request.headers.authorization;
const url = process.env.API + path;
const url = process.env.API_URL + path;
try {
const response = await axios.post(url, sendData, {
headers: {