Merge branch 'develop'

This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2024-12-18 09:59:44 +07:00
commit 865a8ca4cb
4 changed files with 97 additions and 32 deletions

View file

@ -1,5 +1,5 @@
name: release-test name: release
run-name: release-test ${{ github.actor }} run-name: release ${{ github.actor }}
on: on:
push: push:
tags: tags:
@ -9,11 +9,11 @@ env:
REGISTRY: docker.frappet.com REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-salary-service IMAGE_NAME: ehr/bma-ehr-salary-service
DEPLOY_HOST: frappet.com DEPLOY_HOST: frappet.com
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-salary COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-salary
jobs: jobs:
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=version-1.0.36 -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 # act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=version-1.0.36 -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-test: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -67,21 +67,40 @@ jobs:
docker compose pull docker compose pull
docker compose up -d docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- uses: snow-actions/line-notify@v1.1.0 - name: Notify Discord Success
if: success() if: success()
with: run: |
access_token: ${{ secrets.TOKEN_LINE }} curl -H "Content-Type: application/json" \
message: | -X POST \
-Success✅✅✅ -d '{
Image: ${{env.IMAGE_NAME}} "embeds": [{
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }} "title": "✅ Deployment Success!",
By: ${{github.actor}} "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
- uses: snow-actions/line-notify@v1.1.0 "color": 3066993,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Discord Failure
if: failure() if: failure()
with: run: |
access_token: ${{ secrets.TOKEN_LINE }} curl -H "Content-Type: application/json" \
message: | -X POST \
-Failure❌❌❌ -d '{
Image: ${{env.IMAGE_NAME}} "embeds": [{
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }} "title": "❌ Deployment Failed!",
By: ${{github.actor}} "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
"color": 15158332,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/failure-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}

View file

@ -6814,6 +6814,10 @@ export class ReportController extends Controller {
"salaryProfile.firstName", "salaryProfile.firstName",
"salaryProfile.lastName", "salaryProfile.lastName",
"salaryProfile.citizenId", "salaryProfile.citizenId",
"salaryProfile.amount",
"salaryProfile.amountSpecial",
"salaryProfile.amountUse",
"salaryProfile.positionSalaryAmount",
]) ])
.getMany(); .getMany();
@ -6828,6 +6832,10 @@ export class ReportController extends Controller {
firstName: item.firstName, firstName: item.firstName,
lastName: item.lastName, lastName: item.lastName,
citizenId: item.citizenId, citizenId: item.citizenId,
amount: item.amount,
amountSpecial: item.amountSpecial,
amountUse: item.amountUse,
positionSalaryAmount: item.positionSalaryAmount,
})); }));
return new HttpSuccess(_salaryRank); return new HttpSuccess(_salaryRank);
@ -6908,6 +6916,10 @@ export class ReportController extends Controller {
"salaryProfile.firstName", "salaryProfile.firstName",
"salaryProfile.lastName", "salaryProfile.lastName",
"salaryProfile.citizenId", "salaryProfile.citizenId",
"salaryProfile.amount",
"salaryProfile.amountSpecial",
"salaryProfile.amountUse",
"salaryProfile.positionSalaryAmount",
]) ])
.getMany(); .getMany();
@ -6922,6 +6934,10 @@ export class ReportController extends Controller {
firstName: item.firstName, firstName: item.firstName,
lastName: item.lastName, lastName: item.lastName,
citizenId: item.citizenId, citizenId: item.citizenId,
amount: item.amount,
amountSpecial: item.amountSpecial,
amountUse: item.amountUse,
positionSalaryAmount: item.positionSalaryAmount,
})); }));
return new HttpSuccess(_salaryRank); return new HttpSuccess(_salaryRank);
@ -6995,6 +7011,10 @@ export class ReportController extends Controller {
"salaryProfile.firstName", "salaryProfile.firstName",
"salaryProfile.lastName", "salaryProfile.lastName",
"salaryProfile.citizenId", "salaryProfile.citizenId",
"salaryProfile.amount",
"salaryProfile.amountSpecial",
"salaryProfile.amountUse",
"salaryProfile.positionSalaryAmount",
]) ])
.getMany(); .getMany();
@ -7009,6 +7029,10 @@ export class ReportController extends Controller {
firstName: item.firstName, firstName: item.firstName,
lastName: item.lastName, lastName: item.lastName,
citizenId: item.citizenId, citizenId: item.citizenId,
amount: item.amount,
amountSpecial: item.amountSpecial,
amountUse: item.amountUse,
positionSalaryAmount: item.positionSalaryAmount,
})); }));
return new HttpSuccess(_salaryRank); return new HttpSuccess(_salaryRank);
@ -7075,12 +7099,17 @@ export class ReportController extends Controller {
"salaryProfileEmployee.posMasterNo", "salaryProfileEmployee.posMasterNo",
"salaryProfileEmployee.position", "salaryProfileEmployee.position",
"salaryProfileEmployee.posType", "salaryProfileEmployee.posType",
"salaryProfileEmployee.posTypeShort",
"salaryProfileEmployee.posLevel", "salaryProfileEmployee.posLevel",
"salaryProfileEmployee.profileId", "salaryProfileEmployee.profileId",
"salaryProfileEmployee.prefix", "salaryProfileEmployee.prefix",
"salaryProfileEmployee.firstName", "salaryProfileEmployee.firstName",
"salaryProfileEmployee.lastName", "salaryProfileEmployee.lastName",
"salaryProfileEmployee.citizenId", "salaryProfileEmployee.citizenId",
"salaryProfileEmployee.amount",
"salaryProfileEmployee.amountSpecial",
"salaryProfileEmployee.amountUse",
"salaryProfileEmployee.positionSalaryAmount",
]) ])
.getMany(); .getMany();
@ -7089,12 +7118,16 @@ export class ReportController extends Controller {
posMasterNo: `${item.orgShortName}${item.posMasterNo}`, posMasterNo: `${item.orgShortName}${item.posMasterNo}`,
positionName: item.position, positionName: item.position,
posType: item.posType, posType: item.posType,
posLevel: `${item.posTypeShort}${item.posLevel}`, posLevel: `${item.posTypeShort ?? ""} ${item.posLevel ?? ""}`,
profileId: item.profileId, profileId: item.profileId,
prefix: item.prefix, prefix: item.prefix,
firstName: item.firstName, firstName: item.firstName,
lastName: item.lastName, lastName: item.lastName,
citizenId: item.citizenId, citizenId: item.citizenId,
amount: item.amount,
amountSpecial: item.amountSpecial,
amountUse: item.amountUse,
positionSalaryAmount: item.positionSalaryAmount,
})); }));
return new HttpSuccess(_salaryRank); return new HttpSuccess(_salaryRank);
@ -7161,12 +7194,17 @@ export class ReportController extends Controller {
"salaryProfileEmployee.posMasterNo", "salaryProfileEmployee.posMasterNo",
"salaryProfileEmployee.position", "salaryProfileEmployee.position",
"salaryProfileEmployee.posType", "salaryProfileEmployee.posType",
"salaryProfileEmployee.posTypeShort",
"salaryProfileEmployee.posLevel", "salaryProfileEmployee.posLevel",
"salaryProfileEmployee.profileId", "salaryProfileEmployee.profileId",
"salaryProfileEmployee.prefix", "salaryProfileEmployee.prefix",
"salaryProfileEmployee.firstName", "salaryProfileEmployee.firstName",
"salaryProfileEmployee.lastName", "salaryProfileEmployee.lastName",
"salaryProfileEmployee.citizenId", "salaryProfileEmployee.citizenId",
"salaryProfileEmployee.amount",
"salaryProfileEmployee.amountSpecial",
"salaryProfileEmployee.amountUse",
"salaryProfileEmployee.positionSalaryAmount",
]) ])
.getMany(); .getMany();
@ -7175,12 +7213,16 @@ export class ReportController extends Controller {
posMasterNo: `${item.orgShortName}${item.posMasterNo}`, posMasterNo: `${item.orgShortName}${item.posMasterNo}`,
positionName: item.position, positionName: item.position,
posType: item.posType, posType: item.posType,
posLevel: `${item.posTypeShort}${item.posLevel}`, posLevel: `${item.posTypeShort ?? ""} ${item.posLevel ?? ""}`,
profileId: item.profileId, profileId: item.profileId,
prefix: item.prefix, prefix: item.prefix,
firstName: item.firstName, firstName: item.firstName,
lastName: item.lastName, lastName: item.lastName,
citizenId: item.citizenId, citizenId: item.citizenId,
amount: item.amount,
amountSpecial: item.amountSpecial,
amountUse: item.amountUse,
positionSalaryAmount: item.positionSalaryAmount,
})); }));
return new HttpSuccess(_salaryRank); return new HttpSuccess(_salaryRank);
@ -7413,6 +7455,7 @@ export class ReportController extends Controller {
commandYear: number; commandYear: number;
templateDoc: string | null; templateDoc: string | null;
amount: Double | null; amount: Double | null;
amountSpecial: Double | null;
positionSalaryAmount: Double | null; positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null; mouthSalaryAmount: Double | null;
}[]; }[];
@ -7433,6 +7476,7 @@ export class ReportController extends Controller {
profileId: salary.profileId, profileId: salary.profileId,
date: new Date(), date: new Date(),
amount: v.amount, amount: v.amount,
amountSpecial: v.amountSpecial,
commandId: v.commandId, commandId: v.commandId,
positionSalaryAmount: v.positionSalaryAmount, positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount, mouthSalaryAmount: v.mouthSalaryAmount,
@ -7480,6 +7524,7 @@ export class ReportController extends Controller {
commandYear: number; commandYear: number;
templateDoc: string | null; templateDoc: string | null;
amount: Double | null; amount: Double | null;
amountSpecial: Double | null;
positionSalaryAmount: Double | null; positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null; mouthSalaryAmount: Double | null;
}[]; }[];

View file

@ -402,7 +402,7 @@ export class SalaryPeriodEmployeeController extends Controller {
} }
let type = salaryProfile.type; let type = salaryProfile.type;
salaryProfile = await this.testza(type, salaryProfile); salaryProfile = await this.calSalary(type, salaryProfile);
salaryProfile.lastUpdateUserId = req.user.sub; salaryProfile.lastUpdateUserId = req.user.sub;
salaryProfile.lastUpdateFullName = req.user.name; salaryProfile.lastUpdateFullName = req.user.name;
@ -725,7 +725,7 @@ export class SalaryPeriodEmployeeController extends Controller {
salaryProfile.remark = body.remark == null ? _null : body.remark; salaryProfile.remark = body.remark == null ? _null : body.remark;
let type = salaryProfile.type; let type = salaryProfile.type;
salaryProfile = await this.testza(type, salaryProfile); salaryProfile = await this.calSalary(type, salaryProfile);
salaryProfile.lastUpdateUserId = req.user.sub; salaryProfile.lastUpdateUserId = req.user.sub;
salaryProfile.lastUpdateFullName = req.user.name; salaryProfile.lastUpdateFullName = req.user.name;
@ -1083,7 +1083,7 @@ export class SalaryPeriodEmployeeController extends Controller {
} }
let type = salaryProfile.type; let type = salaryProfile.type;
salaryProfile = await this.testza(type, salaryProfile); salaryProfile = await this.calSalary(type, salaryProfile);
const before = null; const before = null;
salaryProfile.salaryOrgId = salaryOrg.id; salaryProfile.salaryOrgId = salaryOrg.id;
@ -1724,7 +1724,7 @@ export class SalaryPeriodEmployeeController extends Controller {
return new HttpSuccess(); return new HttpSuccess();
} }
async testza(type: string, salaryProfile: SalaryProfileEmployee): Promise<SalaryProfileEmployee> { async calSalary(type: string, salaryProfile: SalaryProfileEmployee): Promise<SalaryProfileEmployee> {
if (type == "NONE") { if (type == "NONE") {
salaryProfile.isNext = false; salaryProfile.isNext = false;
salaryProfile.amountSpecial = 0; salaryProfile.amountSpecial = 0;

View file

@ -184,7 +184,7 @@ class CheckAuth {
}); });
} }
public async checkOrg(token: any,keycloakId: string) { public async checkOrg(token: any, keycloakId: string) {
const redisClient = await this.redis.createClient({ const redisClient = await this.redis.createClient({
host: process.env.REDIS_HOST, host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT, port: process.env.REDIS_PORT,
@ -195,14 +195,15 @@ class CheckAuth {
reply = JSON.parse(reply); reply = JSON.parse(reply);
} else { } else {
try { try {
if (!keycloakId) throw "Error calling API No KeycloakId";
const x = await new CallAPI().GetData( const x = await new CallAPI().GetData(
{ {
headers: { authorization: token }, headers: { authorization: token },
}, },
`/org/permission/checkOrg/${keycloakId}`, `/org/permission/checkOrg/${keycloakId}`,
false false,
); );
const data = { const data = {
orgRootId: x.orgRootId, orgRootId: x.orgRootId,
orgChild1Id: x.orgChild1Id, orgChild1Id: x.orgChild1Id,
@ -210,7 +211,7 @@ class CheckAuth {
orgChild3Id: x.orgChild3Id, orgChild3Id: x.orgChild3Id,
orgChild4Id: x.orgChild4Id, orgChild4Id: x.orgChild4Id,
}; };
return data; return data;
} catch (error) { } catch (error) {
console.error("Error calling API:", error); console.error("Error calling API:", error);