Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-07-12 10:23:24 +07:00
commit 83ca592a6d
6 changed files with 54 additions and 53 deletions

View file

@ -9,8 +9,8 @@ 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-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-test:

View file

@ -1,5 +1,17 @@
import { Controller, Request, Get, Post, Put, Delete, Patch, Route, Security, Tags, Path } from "tsoa"; import {
import axios from 'axios'; Controller,
Request,
Get,
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
Path,
} from "tsoa";
import axios from "axios";
import CallAPI from "../interfaces/call-api"; import CallAPI from "../interfaces/call-api";
@Route("/hello") @Route("/hello")
@ -18,10 +30,8 @@ export class AppController extends Controller {
* *
*/ */
@Get("CallOrg") @Get("CallOrg")
public async CallOrg( public async CallOrg(@Request() request: any) {
@Request() request: any, const req = await new CallAPI().GetData(request, "/org/profile/salary/gen");
) {
const req = await new CallAPI().GetData(request, 'org/profile/salary/gen');
return req; return req;
} }
} }

View file

@ -1470,17 +1470,13 @@ export class ReportController extends Controller {
profile: salaryProfileGroup1 profile: salaryProfileGroup1
? salaryProfileGroup1.map((item: any, index: any) => ({ ? salaryProfileGroup1.map((item: any, index: any) => ({
no: Extension.ToThaiNumber(String(index + 1)), no: Extension.ToThaiNumber(String(index + 1)),
fullname: affiliation:
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") + (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") +
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") +
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") +
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") +
(item.root == undefined && item.root == null ? "" : item.root) + (item.root == undefined && item.root == null ? "" : item.root),
"/" + fullName: item.prefix + item.firstName + " " + item.lastName,
item.prefix +
item.firstName +
" " +
item.lastName, // สังกัด/ชื่อ-นามสกุล
posLevel: item.posLevel, posLevel: item.posLevel,
posMasterNo: posMasterNo:
Extension.ToThaiNumber(item.orgShortName) + Extension.ToThaiNumber(item.orgShortName) +
@ -1550,17 +1546,13 @@ export class ReportController extends Controller {
profileGroup2: salaryProfileGroup2 profileGroup2: salaryProfileGroup2
? salaryProfileGroup2.map((item, index) => ({ ? salaryProfileGroup2.map((item, index) => ({
no: Extension.ToThaiNumber(String(index + 1)), no: Extension.ToThaiNumber(String(index + 1)),
fullname: affiliation:
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") + (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") +
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") +
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") +
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") +
(item.root == undefined && item.root == null ? "" : item.root) + (item.root == undefined && item.root == null ? "" : item.root),
"/" + fullName: item.prefix + item.firstName + " " + item.lastName,
item.prefix +
item.firstName +
" " +
item.lastName, // สังกัด/ชื่อ-นามสกุล
posLevel: item.posLevel, posLevel: item.posLevel,
posMasterNo: posMasterNo:
Extension.ToThaiNumber(item.orgShortName) + Extension.ToThaiNumber(item.orgShortName) +
@ -1923,11 +1915,10 @@ export class ReportController extends Controller {
const affiliation = fullNameParts const affiliation = fullNameParts
.filter((part) => part !== undefined && part !== null) .filter((part) => part !== undefined && part !== null)
.join("/"); .join("/");
const position = profile.position;
return { return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()), no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullname: profile.prefix + profile.firstName + " " + profile.lastName, fullname: profile.prefix + profile.firstName + " " + profile.lastName,
position: position, position: profile.position,
affiliation: affiliation, affiliation: affiliation,
posLevel: profile.posLevel, posLevel: profile.posLevel,
posNumber: posNumber:
@ -2018,11 +2009,10 @@ export class ReportController extends Controller {
const affiliation = fullNameParts const affiliation = fullNameParts
.filter((part) => part !== undefined && part !== null) .filter((part) => part !== undefined && part !== null)
.join("/"); .join("/");
const position = profile.position;
return { return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()), no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullname: profile.prefix + profile.firstName + " " + profile.lastName, fullname: profile.prefix + profile.firstName + " " + profile.lastName,
position: position, position: profile.position,
affiliation: affiliation, affiliation: affiliation,
posLevel: profile.posLevel, posLevel: profile.posLevel,
posNumber: posNumber:
@ -6289,7 +6279,7 @@ export class ReportController extends Controller {
}); });
if (salary != null) { if (salary != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile/salary", { .PostData(request, "/org/profile/salary", {
profileId: salary.profileId, profileId: salary.profileId,
date: new Date(), date: new Date(),
amount: salary.positionSalaryAmount, amount: salary.positionSalaryAmount,
@ -6337,7 +6327,7 @@ export class ReportController extends Controller {
}); });
if (salary != null) { if (salary != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile/salary", { .PostData(request, "/org/profile/salary", {
profileId: salary.profileId, profileId: salary.profileId,
date: new Date(), date: new Date(),
amount: salary.positionSalaryAmount, amount: salary.positionSalaryAmount,
@ -6385,7 +6375,7 @@ export class ReportController extends Controller {
}); });
if (salary != null) { if (salary != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile/salary", { .PostData(request, "/org/profile/salary", {
profileId: salary.profileId, profileId: salary.profileId,
date: new Date(), date: new Date(),
amount: salary.positionSalaryAmount, amount: salary.positionSalaryAmount,
@ -6433,7 +6423,7 @@ export class ReportController extends Controller {
}); });
if (salary != null) { if (salary != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile/salary", { .PostData(request, "/org/profile/salary", {
profileId: salary.profileId, profileId: salary.profileId,
date: new Date(), date: new Date(),
amount: salary.positionSalaryAmount, amount: salary.positionSalaryAmount,
@ -6481,7 +6471,7 @@ export class ReportController extends Controller {
}); });
if (salary != null) { if (salary != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile-employee/salary", { .PostData(request, "/org/profile-employee/salary", {
profileEmployeeId: salary.profileId, profileEmployeeId: salary.profileId,
date: new Date(), date: new Date(),
amount: salary.positionSalaryAmount, amount: salary.positionSalaryAmount,

View file

@ -1608,8 +1608,8 @@ export class SalaryPeriodController extends Controller {
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee); await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee); await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id"); let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
let revisionId = await new CallAPI().GetData(request, "org/unauthorize/revision/latest"); let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
salaryPeriod.revisionId = revisionId; salaryPeriod.revisionId = revisionId;
await this.salaryPeriodRepository.save(salaryPeriod); await this.salaryPeriodRepository.save(salaryPeriod);
@ -1717,8 +1717,8 @@ export class SalaryPeriodController extends Controller {
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee); await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee); await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id"); let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
let revisionId = await new CallAPI().GetData(request, "org/unauthorize/revision/latest"); let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
chk_SalaryPeriod.revisionId = revisionId; chk_SalaryPeriod.revisionId = revisionId;
await this.salaryPeriodRepository.save(chk_SalaryPeriod); await this.salaryPeriodRepository.save(chk_SalaryPeriod);
@ -1968,9 +1968,9 @@ export class SalaryPeriodController extends Controller {
}); });
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee); await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee); await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id"); let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
let total = 1000; let total = 1000;
let _orgProfiles = await new CallAPI().PostData(request, "org/unauthorize/salary/gen", { let _orgProfiles = await new CallAPI().PostData(request, "/org/unauthorize/salary/gen", {
page: 1, page: 1,
pageSize: 1000, pageSize: 1000,
keyword: "", keyword: "",
@ -1983,7 +1983,7 @@ export class SalaryPeriodController extends Controller {
const page = Math.ceil(total / 1000); const page = Math.ceil(total / 1000);
for (let index = 2; index <= page; index++) { for (let index = 2; index <= page; index++) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/unauthorize/salary/gen", { .PostData(request, "/org/unauthorize/salary/gen", {
page: index, page: index,
pageSize: 1000, pageSize: 1000,
keyword: "", keyword: "",
@ -1999,7 +1999,7 @@ export class SalaryPeriodController extends Controller {
let orgProfileEmployees: any; let orgProfileEmployees: any;
let _orgProfileEmployees = await new CallAPI().PostData( let _orgProfileEmployees = await new CallAPI().PostData(
request, request,
"org/unauthorize/salary/employee/gen", "/org/unauthorize/salary/employee/gen",
{ {
page: 1, page: 1,
pageSize: 1000, pageSize: 1000,
@ -2014,7 +2014,7 @@ export class SalaryPeriodController extends Controller {
const page = Math.ceil(total / 1000); const page = Math.ceil(total / 1000);
for (let index = 2; index <= page; index++) { for (let index = 2; index <= page; index++) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/unauthorize/salary/employee/gen", { .PostData(request, "/org/unauthorize/salary/employee/gen", {
page: index, page: index,
pageSize: 1000, pageSize: 1000,
keyword: "", keyword: "",
@ -2026,7 +2026,7 @@ export class SalaryPeriodController extends Controller {
}); });
} }
} }
let revisionId = await new CallAPI().GetData(request, "org/unauthorize/revision/latest"); let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
salaryPeriod.revisionId = revisionId; salaryPeriod.revisionId = revisionId;
await this.salaryPeriodRepository.save(salaryPeriod); await this.salaryPeriodRepository.save(salaryPeriod);
@ -2461,9 +2461,9 @@ export class SalaryPeriodController extends Controller {
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee); await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee); await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id"); let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
let total = 1000; let total = 1000;
let _orgProfiles = await new CallAPI().PostData(request, "org/unauthorize/salary/gen", { let _orgProfiles = await new CallAPI().PostData(request, "/org/unauthorize/salary/gen", {
page: 1, page: 1,
pageSize: 1000, pageSize: 1000,
keyword: "", keyword: "",
@ -2476,7 +2476,7 @@ export class SalaryPeriodController extends Controller {
const page = Math.ceil(total / 1000); const page = Math.ceil(total / 1000);
for (let index = 2; index <= page; index++) { for (let index = 2; index <= page; index++) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/unauthorize/profile/salary/gen", { .PostData(request, "/org/unauthorize/profile/salary/gen", {
page: index, page: index,
pageSize: 1000, pageSize: 1000,
keyword: "", keyword: "",
@ -2491,7 +2491,7 @@ export class SalaryPeriodController extends Controller {
total = 1000; total = 1000;
let _orgProfileEmployees = await new CallAPI().PostData( let _orgProfileEmployees = await new CallAPI().PostData(
request, request,
"org/unauthorize/profile/salary/employee/gen", "/org/unauthorize/profile/salary/employee/gen",
{ {
page: 1, page: 1,
pageSize: 1000, pageSize: 1000,
@ -2506,7 +2506,7 @@ export class SalaryPeriodController extends Controller {
const page = Math.ceil(total / 1000); const page = Math.ceil(total / 1000);
for (let index = 2; index <= page; index++) { for (let index = 2; index <= page; index++) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/unauthorize/profile/salary/employee/gen", { .PostData(request, "/org/unauthorize/profile/salary/employee/gen", {
page: index, page: index,
pageSize: 1000, pageSize: 1000,
keyword: "", keyword: "",
@ -2518,7 +2518,7 @@ export class SalaryPeriodController extends Controller {
}); });
} }
} }
let revisionId = await new CallAPI().GetData(request, "org/unauthorize/revision/latest"); let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
salaryPeriod.revisionId = revisionId; salaryPeriod.revisionId = revisionId;
await this.salaryPeriodRepository.save(salaryPeriod); await this.salaryPeriodRepository.save(salaryPeriod);

View file

@ -1487,6 +1487,7 @@ export class SalaryPeriodEmployeeController extends Controller {
const mapSalaryProfile = salaryProfile.map((item) => ({ const mapSalaryProfile = salaryProfile.map((item) => ({
id: item.id, id: item.id,
profileId: item.profileId,
salaryOrgId: item.salaryOrgId, salaryOrgId: item.salaryOrgId,
salaryLevel: item.salaryLevel, salaryLevel: item.salaryLevel,
salaryLevelNew: item.salaryLevelNew, salaryLevelNew: item.salaryLevelNew,
@ -2135,8 +2136,8 @@ export class SalaryPeriodEmployeeController extends Controller {
await this.salaryOrgRepository.remove(salaryOrg); await this.salaryOrgRepository.remove(salaryOrg);
await this.salaryProfileRepository.remove(salaryProfile); await this.salaryProfileRepository.remove(salaryProfile);
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id"); let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
let revisionId = await new CallAPI().GetData(request, "org/unauthorize/revision/latest"); let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
salaryPeriod.revisionId = revisionId; salaryPeriod.revisionId = revisionId;
await this.salaryPeriodRepository.save(salaryPeriod); await this.salaryPeriodRepository.save(salaryPeriod);
@ -2217,8 +2218,8 @@ export class SalaryPeriodEmployeeController extends Controller {
await this.salaryOrgRepository.remove(salaryOrg); await this.salaryOrgRepository.remove(salaryOrg);
await this.salaryProfileRepository.remove(salaryProfile); await this.salaryProfileRepository.remove(salaryProfile);
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id"); let orgs = await new CallAPI().GetData(request, "/org/unauthorize/active/root/id");
let revisionId = await new CallAPI().GetData(request, "org/unauthorize/revision/latest"); let revisionId = await new CallAPI().GetData(request, "/org/unauthorize/revision/latest");
chk_SalaryPeriod.revisionId = revisionId; chk_SalaryPeriod.revisionId = revisionId;
await this.salaryPeriodRepository.save(chk_SalaryPeriod); await this.salaryPeriodRepository.save(chk_SalaryPeriod);

View file

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