Merge branch 'develop' into adiDev
This commit is contained in:
commit
b0f5ff78d8
1 changed files with 142 additions and 62 deletions
|
|
@ -17,6 +17,7 @@ import {
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import { OrgRevision } from "../entities/OrgRevision";
|
import { OrgRevision } from "../entities/OrgRevision";
|
||||||
import { In } from "typeorm";
|
import { In } from "typeorm";
|
||||||
|
import { ProfileSalary } from "../entities/ProfileSalary";
|
||||||
@Route("api/v1/org/profile-employee/government")
|
@Route("api/v1/org/profile-employee/government")
|
||||||
@Tags("ProfileEmployeeGovernment")
|
@Tags("ProfileEmployeeGovernment")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -26,6 +27,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
private positionRepo = AppDataSource.getRepository(EmployeePosition);
|
private positionRepo = AppDataSource.getRepository(EmployeePosition);
|
||||||
private posMasterRepo = AppDataSource.getRepository(EmployeePosMaster);
|
private posMasterRepo = AppDataSource.getRepository(EmployeePosMaster);
|
||||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||||
|
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary ข้อมูลราชการ
|
* @summary ข้อมูลราชการ
|
||||||
|
|
@ -150,32 +152,32 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
const record = await this.profileEmployeeRepo.findOne({
|
const record = await this.profileEmployeeRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: profileEmployeeId,
|
id: profileEmployeeId,
|
||||||
profileSalary: {
|
// profileSalary: {
|
||||||
commandCode: In([
|
// commandCode: In([
|
||||||
"0",
|
// "0",
|
||||||
"9",
|
// "9",
|
||||||
"1",
|
// "1",
|
||||||
"2",
|
// "2",
|
||||||
"3",
|
// "3",
|
||||||
"4",
|
// "4",
|
||||||
"8",
|
// "8",
|
||||||
"10",
|
// "10",
|
||||||
"11",
|
// "11",
|
||||||
"12",
|
// "12",
|
||||||
"13",
|
// "13",
|
||||||
"14",
|
// "14",
|
||||||
"15",
|
// "15",
|
||||||
"16",
|
// "16",
|
||||||
]),
|
// ]),
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "profileSalary"],
|
relations: ["posType", "posLevel"/*, "profileSalary"*/],
|
||||||
order: {
|
// order: {
|
||||||
profileSalary: {
|
// profileSalary: {
|
||||||
order: "DESC",
|
// order: "DESC",
|
||||||
createdAt: "DESC"
|
// createdAt: "DESC"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -216,16 +218,55 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _OrgLeave:any = []
|
let _OrgLeave:any = []
|
||||||
if (record?.isLeave && record?.profileSalary.length > 0) {
|
let orgLeave:string = ""
|
||||||
|
let posNoLeave:string = ""
|
||||||
|
if (record?.isLeave /*&& record?.profileSalary.length > 0*/) {
|
||||||
|
const profileSalary = await this.salaryRepo.find({
|
||||||
|
select: [
|
||||||
|
"orgRoot",
|
||||||
|
"orgChild1",
|
||||||
|
"orgChild2",
|
||||||
|
"orgChild3",
|
||||||
|
"orgChild4",
|
||||||
|
"posNoAbb",
|
||||||
|
"posNo"
|
||||||
|
],
|
||||||
|
where: {
|
||||||
|
profileEmployeeId: profileEmployeeId,
|
||||||
|
commandCode: In([
|
||||||
|
"0",
|
||||||
|
"9",
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"8",
|
||||||
|
"10",
|
||||||
|
"11",
|
||||||
|
"12",
|
||||||
|
"13",
|
||||||
|
"14",
|
||||||
|
"15",
|
||||||
|
"16",
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
order: "DESC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
});
|
||||||
_OrgLeave = [
|
_OrgLeave = [
|
||||||
record?.profileSalary[0].orgChild4 ? record?.profileSalary[0].orgChild4 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
|
||||||
record?.profileSalary[0].orgChild3 ? record?.profileSalary[0].orgChild3 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild3 ? profileSalary[0].orgChild3 : null,
|
||||||
record?.profileSalary[0].orgChild2 ? record?.profileSalary[0].orgChild2 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild2 ? profileSalary[0].orgChild2 : null,
|
||||||
record?.profileSalary[0].orgChild1 ? record?.profileSalary[0].orgChild1 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild1 ? profileSalary[0].orgChild1 : null,
|
||||||
record?.profileSalary[0].orgRoot ? record?.profileSalary[0].orgRoot : null,
|
profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
|
||||||
];
|
];
|
||||||
|
orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
|
||||||
|
posNoLeave = profileSalary.length > 0
|
||||||
|
? `${profileSalary[0].posNoAbb} ${profileSalary[0].posNo}`
|
||||||
|
: ""
|
||||||
}
|
}
|
||||||
const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
|
|
||||||
const data = {
|
const data = {
|
||||||
org: record?.isLeave == false ? org : orgLeave, //สังกัด
|
org: record?.isLeave == false ? org : orgLeave, //สังกัด
|
||||||
position: record?.position, //ตำแหน่ง
|
position: record?.position, //ตำแหน่ง
|
||||||
|
|
@ -235,9 +276,9 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
|
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
|
||||||
posMasterNo: record?.isLeave == false
|
posMasterNo: record?.isLeave == false
|
||||||
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
|
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
|
||||||
: record && record?.profileSalary.length > 0
|
: posNoLeave/*record && record?.profileSalary.length > 0
|
||||||
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
|
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
|
||||||
: null, //เลขที่ตำแหน่ง
|
: null*/, //เลขที่ตำแหน่ง
|
||||||
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
|
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
|
||||||
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
|
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
|
||||||
dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
|
dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
|
||||||
|
|
@ -265,29 +306,29 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
const record = await this.profileEmployeeRepo.findOne({
|
const record = await this.profileEmployeeRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: profileEmployeeId,
|
id: profileEmployeeId,
|
||||||
profileSalary:{
|
// profileSalary:{
|
||||||
commandCode: In([
|
// commandCode: In([
|
||||||
"0",
|
// "0",
|
||||||
"9",
|
// "9",
|
||||||
"1",
|
// "1",
|
||||||
"2",
|
// "2",
|
||||||
"3",
|
// "3",
|
||||||
"4",
|
// "4",
|
||||||
"8",
|
// "8",
|
||||||
"10",
|
// "10",
|
||||||
"11",
|
// "11",
|
||||||
"12",
|
// "12",
|
||||||
"13",
|
// "13",
|
||||||
"14",
|
// "14",
|
||||||
"15",
|
// "15",
|
||||||
"16",
|
// "16",
|
||||||
]),
|
// ]),
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
relations: {
|
relations: {
|
||||||
posType: true,
|
posType: true,
|
||||||
posLevel: true,
|
posLevel: true,
|
||||||
profileSalary: true
|
// profileSalary: true
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
|
|
@ -329,16 +370,55 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _OrgLeave:any = []
|
let _OrgLeave:any = []
|
||||||
if (record?.isLeave && record?.profileSalary.length > 0) {
|
let orgLeave:string = ""
|
||||||
|
let posNoLeave:string = ""
|
||||||
|
if (record?.isLeave /*&& record?.profileSalary.length > 0*/) {
|
||||||
|
const profileSalary = await this.salaryRepo.find({
|
||||||
|
select: [
|
||||||
|
"orgRoot",
|
||||||
|
"orgChild1",
|
||||||
|
"orgChild2",
|
||||||
|
"orgChild3",
|
||||||
|
"orgChild4",
|
||||||
|
"posNoAbb",
|
||||||
|
"posNo"
|
||||||
|
],
|
||||||
|
where: {
|
||||||
|
profileEmployeeId: profileEmployeeId,
|
||||||
|
commandCode: In([
|
||||||
|
"0",
|
||||||
|
"9",
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"8",
|
||||||
|
"10",
|
||||||
|
"11",
|
||||||
|
"12",
|
||||||
|
"13",
|
||||||
|
"14",
|
||||||
|
"15",
|
||||||
|
"16",
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
order: "DESC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
});
|
||||||
_OrgLeave = [
|
_OrgLeave = [
|
||||||
record?.profileSalary[0].orgChild4 ? record?.profileSalary[0].orgChild4 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild4 ? profileSalary[0].orgChild4 : null,
|
||||||
record?.profileSalary[0].orgChild3 ? record?.profileSalary[0].orgChild3 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild3 ? profileSalary[0].orgChild3 : null,
|
||||||
record?.profileSalary[0].orgChild2 ? record?.profileSalary[0].orgChild2 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild2 ? profileSalary[0].orgChild2 : null,
|
||||||
record?.profileSalary[0].orgChild1 ? record?.profileSalary[0].orgChild1 : null,
|
profileSalary.length > 0 && profileSalary[0].orgChild1 ? profileSalary[0].orgChild1 : null,
|
||||||
record?.profileSalary[0].orgRoot ? record?.profileSalary[0].orgRoot : null,
|
profileSalary.length > 0 && profileSalary[0].orgRoot ? profileSalary[0].orgRoot : null,
|
||||||
];
|
];
|
||||||
|
orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
|
||||||
|
posNoLeave = profileSalary.length > 0
|
||||||
|
? `${profileSalary[0].posNoAbb} ${profileSalary[0].posNo}`
|
||||||
|
: ""
|
||||||
}
|
}
|
||||||
const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n");
|
|
||||||
const data = {
|
const data = {
|
||||||
org: record?.isLeave == false ? org : orgLeave, //สังกัด
|
org: record?.isLeave == false ? org : orgLeave, //สังกัด
|
||||||
position: record?.position, //ตำแหน่ง
|
position: record?.position, //ตำแหน่ง
|
||||||
|
|
@ -350,9 +430,9 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
? posMaster == null
|
? posMaster == null
|
||||||
? null
|
? null
|
||||||
: `${orgShortName} ${posMaster.posMasterNo}`
|
: `${orgShortName} ${posMaster.posMasterNo}`
|
||||||
: record && record.profileSalary.length > 0
|
: posNoLeave/*record && record.profileSalary.length > 0
|
||||||
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
|
? `${record?.profileSalary[0].posNoAbb} ${record?.profileSalary[0].posNo}`
|
||||||
: null, //เลขที่ตำแหน่ง
|
: null*/, //เลขที่ตำแหน่ง
|
||||||
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
|
posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท
|
||||||
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
|
dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), //วันเกษียณ
|
||||||
dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
|
dateAppoint: record?.dateAppoint, //วันที่สั่งบรรจุ
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue