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
IMAGE_NAME: ehr/bma-ehr-salary-service
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-ehr
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-salary
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
release-test:

View file

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

View file

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

View file

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

View file

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

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: {