Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2025-04-30 15:25:14 +07:00
commit e95a299ab2
21 changed files with 3259 additions and 4279 deletions

View file

@ -1742,17 +1742,18 @@ export class CommandController extends Controller {
return {
no: Extension.ToThaiNumber((idx + 1).toString()),
org: commandCode != "C-PM-21"
? (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root)
: (profile?.child4Temp == null ? "" : profile?.child4Temp + "\n") +
(profile?.child3Temp == null ? "" : profile?.child3Temp + "\n") +
(profile?.child2Temp == null ? "" : profile?.child2Temp + "\n") +
(profile?.child1Temp == null ? "" : profile?.child1Temp + "\n") +
(profile?.rootTemp == null ? "" : profile?.rootTemp),
org:
commandCode != "C-PM-21"
? (_child4 == null ? "" : _child4 + "\n") +
(_child3 == null ? "" : _child3 + "\n") +
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root)
: (profile?.child4Temp == null ? "" : profile?.child4Temp + "\n") +
(profile?.child3Temp == null ? "" : profile?.child3Temp + "\n") +
(profile?.child2Temp == null ? "" : profile?.child2Temp + "\n") +
(profile?.child1Temp == null ? "" : profile?.child1Temp + "\n") +
(profile?.rootTemp == null ? "" : profile?.rootTemp),
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
citizenId: Extension.ToThaiNumber(x.citizenId),
position: profile?.position ? profile?.position : "-",
@ -1762,24 +1763,27 @@ export class CommandController extends Controller {
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
)
: "-",
posNo: commandCode != "C-PM-21"
? shortName
? Extension.ToThaiNumber(shortName)
: "-"
: Extension.ToThaiNumber(`${profile?.rootShortNameTemp}${profile?.posMasterNoTemp}`) ,
posNo:
commandCode != "C-PM-21"
? shortName
? Extension.ToThaiNumber(shortName)
: "-"
: Extension.ToThaiNumber(
`${profile?.rootShortNameTemp}${profile?.posMasterNoTemp}`,
),
amount: x.amount ? Extension.ToThaiNumber(x.amount.toLocaleString()) : "-",
dateRetire: profile?.dateRetire
? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(profile?.dateRetire)
)
dateRetire: profile?.dateRetire
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile?.dateRetire))
: profile?.birthDate && commandCode == "C-PM-21"
? Extension.ToThaiNumber(
Extension.ToThaiShortDate_monthYear(
new Date(
profile.birthDate.getFullYear() + 60, profile.birthDate.getMonth(), profile.birthDate.getDate()
)
Extension.ToThaiShortDate_monthYear(
new Date(
profile.birthDate.getFullYear() + 60,
profile.birthDate.getMonth(),
profile.birthDate.getDate(),
),
),
)
)
: "-",
dateExecute: command.commandExcecuteDate
? Extension.ToThaiNumber(
@ -2421,12 +2425,10 @@ export class CommandController extends Controller {
"C-PM-22",
"C-PM-23",
"C-PM-24",
"C-PM-34",
"C-PM-36",
"C-PM-37",
"C-PM-37",
"C-PM-37",
"C-PM-37",
"C-PM-42",
"C-PM-43",
].includes(commandCode)
) {
let posMaster = await this.employeePosMasterRepository.find({
@ -2953,10 +2955,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -2965,35 +2967,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -3129,10 +3131,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -3141,35 +3143,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -3324,10 +3326,10 @@ export class CommandController extends Controller {
const roleKeycloak = await this.roleKeycloakRepo.findOne({
where: { name: Like("USER") },
});
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -3336,35 +3338,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -3541,10 +3543,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -3553,35 +3555,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -3702,10 +3704,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -3714,35 +3716,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -4011,10 +4013,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -4023,35 +4025,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -4492,10 +4494,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -4504,35 +4506,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -4764,10 +4766,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -4776,35 +4778,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -4968,10 +4970,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -4980,35 +4982,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -5137,7 +5139,7 @@ export class CommandController extends Controller {
commandName: item.commandName,
remark: item.remark,
posNumCodeSit: _posNumCodeSit,
posNumCodeSitAbb: _posNumCodeSitAbb
posNumCodeSitAbb: _posNumCodeSitAbb,
});
await removeProfileInOrganize(profile.id, "OFFICER");
const clearProfile = await checkCommandType(String(item.commandId));
@ -5219,10 +5221,10 @@ export class CommandController extends Controller {
const list = await getRoles();
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
const _null: any = null;
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.data.find(x => x.bodySalarys?.commandId)?.bodySalarys?.commandId ?? "" }
where: { id: body.data.find((x) => x.bodySalarys?.commandId)?.bodySalarys?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -5231,35 +5233,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -5724,10 +5726,10 @@ export class CommandController extends Controller {
const roleKeycloak = await this.roleKeycloakRepo.findOne({
where: { name: Like("USER") },
});
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.refIds.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.refIds.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -5736,35 +5738,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(
@ -6274,10 +6276,10 @@ export class CommandController extends Controller {
}[];
},
) {
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.refIds.find(x => x.commandId)?.commandId ?? "" }
where: { id: body.refIds.find((x) => x.commandId)?.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -6286,35 +6288,35 @@ export class CommandController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileRepository.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
await Promise.all(

View file

@ -572,7 +572,7 @@ export class EmployeePositionController extends Controller {
const chk_SName0 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgRoot: { orgRootShortName: SName },
orgRoot: { orgRootShortName: SName, /*id: requestBody.orgRootId ?? ""*/ },
orgChild1Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
},
@ -588,7 +588,7 @@ export class EmployeePositionController extends Controller {
const chk_SName1 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild1: { orgChild1ShortName: SName },
orgChild1: { orgChild1ShortName: SName, /*id: requestBody.orgChild1Id ?? ""*/ },
orgChild2Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
},
@ -604,7 +604,7 @@ export class EmployeePositionController extends Controller {
const chk_SName2 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild2: { orgChild2ShortName: SName },
orgChild2: { orgChild2ShortName: SName, /*id: requestBody.orgChild2Id ?? ""*/ },
orgChild3Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
},
@ -620,7 +620,7 @@ export class EmployeePositionController extends Controller {
const chk_SName3 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild3: { orgChild3ShortName: SName },
orgChild3: { orgChild3ShortName: SName, /*id: requestBody.orgChild3Id ?? ""*/ },
orgChild4Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
},
@ -636,7 +636,7 @@ export class EmployeePositionController extends Controller {
const chk_SName4 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild4: { orgChild4ShortName: SName },
orgChild4: { orgChild4ShortName: SName, /*id: requestBody.orgChild4Id ?? ""*/ },
posMasterNo: requestBody.posMasterNo,
},
relations: ["orgChild4"],
@ -780,7 +780,7 @@ export class EmployeePositionController extends Controller {
const chk_SName0 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgRoot: { orgRootShortName: SName },
orgRoot: { orgRootShortName: SName, /*id: requestBody.orgRootId ?? ""*/ },
orgChild1Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
id: Not(posMaster.id),
@ -797,7 +797,7 @@ export class EmployeePositionController extends Controller {
const chk_SName1 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild1: { orgChild1ShortName: SName },
orgChild1: { orgChild1ShortName: SName, /*id: requestBody.orgChild1Id ?? ""*/ },
orgChild2Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
id: Not(posMaster.id),
@ -814,7 +814,7 @@ export class EmployeePositionController extends Controller {
const chk_SName2 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild2: { orgChild2ShortName: SName },
orgChild2: { orgChild2ShortName: SName, /*id: requestBody.orgChild2Id ?? ""*/ },
orgChild3Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
id: Not(posMaster.id),
@ -831,7 +831,7 @@ export class EmployeePositionController extends Controller {
const chk_SName3 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild3: { orgChild3ShortName: SName },
orgChild3: { orgChild3ShortName: SName, /*id: requestBody.orgChild3Id ?? ""*/ },
orgChild4Id: IsNull(),
posMasterNo: requestBody.posMasterNo,
id: Not(posMaster.id),
@ -848,7 +848,7 @@ export class EmployeePositionController extends Controller {
const chk_SName4 = await this.employeePosMasterRepository.findOne({
where: {
orgRevisionId: posMaster.orgRevisionId,
orgChild4: { orgChild4ShortName: SName },
orgChild4: { orgChild4ShortName: SName, /*id: requestBody.orgChild4Id ?? ""*/ },
posMasterNo: requestBody.posMasterNo,
id: Not(posMaster.id),
},

File diff suppressed because it is too large Load diff

View file

@ -1694,11 +1694,11 @@ export class OrganizationDotnetController extends Controller {
return new HttpSuccess(mapProfile);
}
/**
* 3. API Get Profile keycloak id
* 3. API Get Profile citizen Id
*
* @summary 3. API Get Profile keycloak id
* @summary 3. API Get Profile citizen Id
*
* @param {string} citizenId Id keycloak
* @param {string} citizenId citizen Id
*/
@Get("citizenId/{citizenId}")
async GetProfileByCitizenIdAsync(@Path() citizenId: string) {

View file

@ -1630,7 +1630,7 @@ export class ProfileEmployeeController extends Controller {
firstName: _data.firstName,
lastName: _data.lastName,
citizenId: _data.citizenId,
posLevel: _data.posLevel == null ? null : _data.posLevel.posLevelName,
posLevel: `${_data.posType.posTypeShortName?? ""} ${_data.posLevel.posLevelName ?? ""}`,
posType: _data.posType == null ? null : _data.posType.posTypeName,
posLevelId: _data.posLevel == null ? null : _data.posLevel.id,
posTypeId: _data.posType == null ? null : _data.posType.id,
@ -1907,7 +1907,9 @@ export class ProfileEmployeeController extends Controller {
: "1=1",
)
.andWhere(
retireType != undefined && retireType != null ? `profileEmployee.leaveType = :retireType` : "1=1",
retireType != undefined && retireType != null
? `profileEmployee.leaveType = :retireType`
: "1=1",
{ retireType: retireType },
)
.andWhere("profileEmployee.employeeClass LIKE :type", {
@ -2033,7 +2035,7 @@ export class ProfileEmployeeController extends Controller {
positionId: _data.positionIdTemp,
posmasterId: _data.posmasterIdTemp,
position: _data.position,
posNo:
posNo:
_data.profileSalary[0].posNoAbb && _data.profileSalary[0].posNo
? _data.profileSalary[0].posNoAbb + _data.profileSalary[0].posNo
: _data.profileSalary[0].posNo || "",
@ -2443,11 +2445,19 @@ export class ProfileEmployeeController extends Controller {
posLevel: _data.posLevel == null ? null : _data.posLevel.posLevelName,
posType: _data.posType == null ? null : _data.posType.posTypeName,
posTypeShortName: _data.posType == null ? null : _data.posType.posTypeShortName,
posLevelTemp: _data.posLevelNameTemp,
posTypeTemp: _data.posTypeNameTemp,
posTypeShortNameTemp: _data.posTypeShortNameTemp,
posLevelId: _data.posLevel == null ? null : _data.posLevel.id,
posTypeId: _data.posType == null ? null : _data.posType.id,
positionId: _data.positionIdTemp,
posmasterId: _data.posmasterIdTemp,
position: _data.position,
positionTemp: _data.positionTemp,
posNo: _data.employeeClass == "TEMP" ? _data.posMasterNoTemp : shortName,
employeeClass: _data.employeeClass == null ? null : _data.employeeClass,
govAge: Extension.CalculateGovAge(_data.dateAppoint, 0, 0),
@ -2518,6 +2528,12 @@ export class ProfileEmployeeController extends Controller {
(_child2 == null ? "" : _child2 + "\n") +
(_child1 == null ? "" : _child1 + "\n") +
(_root == null ? "" : _root),
orgTemp:
(_data.child4Temp == null ? "" : _data.child4Temp + "\n") +
(_data.child3Temp == null ? "" : _data.child3Temp + "\n") +
(_data.child2Temp == null ? "" : _data.child2Temp + "\n") +
(_data.child1Temp == null ? "" : _data.child1Temp + "\n") +
(_data.rootTemp == null ? "" : _data.rootTemp),
};
}),
);
@ -2574,7 +2590,7 @@ export class ProfileEmployeeController extends Controller {
}
const [profiles, total] = await this.profileRepo
.createQueryBuilder("profileEmployee")
.leftJoinAndSelect("profileEmployee.next_holders", "next_holders")
.leftJoinAndSelect("profileEmployee.current_holders", "current_holders")
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
.leftJoinAndSelect("profileEmployee.posType", "posType")
.where(
@ -2590,12 +2606,29 @@ export class ProfileEmployeeController extends Controller {
new Brackets((qb) => {
qb.where(
requestBody.keyword != null && requestBody.keyword != ""
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
? "profileEmployee.prefix LIKE :keyword"
: "1=1",
{
keyword: `%${requestBody.keyword}%`,
},
).orWhere(
)
.orWhere(
requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.firstName LIKE :keyword"
: "1=1",
{
keyword: `%${requestBody.keyword}%`,
},
)
.orWhere(
requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.lastName LIKE :keyword"
: "1=1",
{
keyword: `%${requestBody.keyword}%`,
},
)
.orWhere(
requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.citizenId LIKE :keyword"
: "1=1",
@ -2626,19 +2659,22 @@ export class ProfileEmployeeController extends Controller {
qb.where("profileEmployee.id NOT IN (:...ids)", {
ids:
orgRevision.employeePosMasters
.filter((x) => x.next_holderId != null)
.map((x) => x.next_holderId).length == 0
.filter((x) => x.current_holderId != null)
.map((x) => x.current_holderId).length == 0
? ["zxc"]
: orgRevision.employeePosMasters
.filter((x) => x.next_holderId != null)
.map((x) => x.next_holderId),
.filter((x) => x.current_holderId != null)
.map((x) => x.current_holderId),
});
}),
)
.andWhere("profileEmployee.employeeClass = :employeeClass", { employeeClass: "PERM" })
.skip((requestBody.page - 1) * requestBody.pageSize)
.take(requestBody.pageSize)
.orderBy("posType.posTypeRank", "ASC")
.addOrderBy("posLevel.posLevelRank", "ASC")
.getManyAndCount();
const data = profiles.map((_data) => ({
id: _data.id,
prefix: _data.prefix,
@ -3670,10 +3706,18 @@ export class ProfileEmployeeController extends Controller {
profileEmp.positionFieldTemp = body.positionField;
profileEmp.posTypeIdTemp = String(body.posTypeId);
profileEmp.posTypeNameTemp = body.posTypeName;
if (body.posTypeId != null) {
const posTypeTemp = await this.posTypeRepo.findOne({
where: { id: body.posTypeId },
});
if (posTypeTemp != null) {
profileEmp.posTypeShortNameTemp = posTypeTemp.posTypeShortName;
}
}
profileEmp.posLevelIdTemp = String(body.posLevelId);
profileEmp.posLevelNameTemp = body.posLevelName;
profileEmp.statusTemp = "PENDING";
this.profileRepo.merge(profileEmp, body);
// this.profileRepo.merge(profileEmp, body);
await this.profileRepo.save(profileEmp);
return new HttpSuccess();
}

View file

@ -1704,7 +1704,7 @@ export class ProfileEmployeeTempController extends Controller {
}
const [profiles, total] = await this.profileRepo
.createQueryBuilder("profileEmployee")
.leftJoinAndSelect("profileEmployee.next_holderTemps", "next_holderTemps")
.leftJoinAndSelect("profileEmployee.current_holderTemps", "current_holderTemps")
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
.leftJoinAndSelect("profileEmployee.posType", "posType")
.where(
@ -1720,12 +1720,29 @@ export class ProfileEmployeeTempController extends Controller {
new Brackets((qb) => {
qb.where(
requestBody.keyword != null && requestBody.keyword != ""
? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword`
? "profileEmployee.prefix LIKE :keyword"
: "1=1",
{
keyword: `%${requestBody.keyword}%`,
},
).orWhere(
)
.orWhere(
requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.firstName LIKE :keyword"
: "1=1",
{
keyword: `%${requestBody.keyword}%`,
},
)
.orWhere(
requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.lastName LIKE :keyword"
: "1=1",
{
keyword: `%${requestBody.keyword}%`,
},
)
.orWhere(
requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.citizenId LIKE :keyword"
: "1=1",
@ -1780,18 +1797,20 @@ export class ProfileEmployeeTempController extends Controller {
qb.where("profileEmployee.id NOT IN (:...ids)", {
ids:
orgRevision.employeeTempPosMasters
.filter((x) => x.next_holderId != null)
.map((x) => x.next_holderId).length == 0
.filter((x) => x.current_holderId != null)
.map((x) => x.current_holderId).length == 0
? ["zxc"]
: orgRevision.employeeTempPosMasters
.filter((x) => x.next_holderId != null)
.map((x) => x.next_holderId),
.filter((x) => x.current_holderId != null)
.map((x) => x.current_holderId),
});
}),
)
.andWhere("profileEmployee.employeeClass = :employeeClass", { employeeClass: "TEMP" })
.skip((requestBody.page - 1) * requestBody.pageSize)
.take(requestBody.pageSize)
.orderBy("posType.posTypeRank", "ASC")
.addOrderBy("posLevel.posLevelRank", "ASC")
.getManyAndCount();
const data = profiles.map((_data) => ({
id: _data.id,

View file

@ -24,7 +24,7 @@ import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
import { RequestWithUser } from "../middlewares/user";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { Profile } from "../entities/Profile";
import { In, LessThan, MoreThan } from "typeorm";
import { In, LessThan, IsNull, MoreThan } from "typeorm";
import permission from "../interfaces/permission";
import { setLogDataDiff } from "../interfaces/utils";
import { Command } from "../entities/Command";
@ -47,7 +47,7 @@ export class ProfileSalaryEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.salaryRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, commandCode: In(["5", "6", "7"]) },
order: { order: "ASC" },
});
return new HttpSuccess(record);
@ -60,7 +60,28 @@ export class ProfileSalaryEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.salaryRepo.find({
where: { profileEmployeeId: profile.id },
where: [
{
profileEmployeeId: profile.id,
commandCode: In([
"0",
"9",
"1",
"2",
"3",
"4",
"8",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
]),
},
{ profileEmployeeId: profile.id, commandCode: IsNull() },
],
order: { order: "ASC" },
});
return new HttpSuccess(record);
@ -87,7 +108,28 @@ export class ProfileSalaryEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const record = await this.salaryRepo.find({
where: { profileEmployeeId: profileId },
where: [
{
profileEmployeeId: profileId,
commandCode: In([
"0",
"9",
"1",
"2",
"3",
"4",
"8",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
]),
},
{ profileEmployeeId: profileId, commandCode: IsNull() },
],
order: { order: "ASC" },
});
return new HttpSuccess(record);
@ -131,7 +173,9 @@ export class ProfileSalaryEmployeeController extends Controller {
[] as { name: string; days: number; year: number; month: number; day: number }[],
);
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [profile.id]);
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [
profile.id,
]);
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
const mapPosLevel =
_posLevel.length > 1
@ -204,7 +248,9 @@ export class ProfileSalaryEmployeeController extends Controller {
[] as { name: string; days: number; year: number; month: number; day: number }[],
);
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [profileId]);
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [
profileId,
]);
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
const mapPosLevel =
_posLevel.length > 1
@ -248,7 +294,7 @@ export class ProfileSalaryEmployeeController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
const record = await this.salaryRepo.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, commandCode: In(["5", "6", "7"]) },
order: { order: "ASC" },
});
return new HttpSuccess(record);
@ -318,9 +364,9 @@ export class ProfileSalaryEmployeeController extends Controller {
lastUpdatedAt: new Date(),
};
if (body.commandCode && !body.commandName) {
if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ"
else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ"
else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ"
if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ";
else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ";
else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ";
}
Object.assign(data, { ...body, ...meta });
const history = new ProfileSalaryHistory();
@ -359,10 +405,10 @@ export class ProfileSalaryEmployeeController extends Controller {
order: { order: "DESC" },
});
const before = null;
let _posNumCodeSit: string = ""
let _posNumCodeSitAbb: string = ""
let _posNumCodeSit: string = "";
let _posNumCodeSitAbb: string = "";
const _command = await this.commandRepository.findOne({
where: { id: body.commandId ?? "" }
where: { id: body.commandId ?? "" },
});
if (_command) {
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
@ -371,35 +417,35 @@ export class ProfileSalaryEmployeeController extends Controller {
isDeputy: true,
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
orgRevisionIsDraft: false,
},
},
relations: ["orgRevision"]
})
relations: ["orgRevision"],
});
_posNumCodeSit = orgRootDeputy ? orgRootDeputy?.orgRootName : "สำนักปลัดกรุงเทพมหานคร";
_posNumCodeSitAbb = orgRootDeputy ? orgRootDeputy?.orgRootShortName : "สนป.";
}
else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร"
_posNumCodeSitAbb = "กทม."
}
else {
} else if (_command?.isBangkok?.toLocaleUpperCase() == "BANGKOK") {
_posNumCodeSit = "กรุงเทพมหานคร";
_posNumCodeSitAbb = "กทม.";
} else {
let _profileAdmin = await this.profileGovementRepo.findOne({
where: {
where: {
keycloak: _command?.createdUserId.toString(),
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
}
orgRevisionIsDraft: false,
},
},
},
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"]
relations: ["current_holders", "current_holders.orgRevision", "current_holders.orgRoot"],
});
_posNumCodeSit = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
_posNumCodeSitAbb = _profileAdmin?.current_holders
.find(x => x.orgRoot.orgRootShortName)?.orgRoot.orgRootShortName ?? ""
_posNumCodeSit =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootName)?.orgRoot.orgRootName ??
"";
_posNumCodeSitAbb =
_profileAdmin?.current_holders.find((x) => x.orgRoot.orgRootShortName)?.orgRoot
.orgRootShortName ?? "";
}
}
const data = new ProfileSalary();
@ -451,9 +497,9 @@ export class ProfileSalaryEmployeeController extends Controller {
const before = structuredClone(record);
const history = new ProfileSalaryHistory();
if (body.commandCode && !body.commandName) {
if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ"
else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ"
else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ"
if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ";
else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ";
else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ";
}
Object.assign(record, body);
Object.assign(history, { ...record, id: undefined });

189
src/entities/EMPLOYEE.ts Normal file
View file

@ -0,0 +1,189 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("EMPLOYEE")
export class EMPLOYEE {
@PrimaryGeneratedColumn()
id!: number;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// RET_YEAR: string;
@Column({
nullable: true,
type: "text",
default: null,
})
ID: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// MP_CATEGORY: string;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// MP_LEVEL: string;
@Column({
nullable: true,
type: "text",
default: null,
})
BORN: string;
@Column({
nullable: true,
type: "text",
default: null,
})
RANK_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FNAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
LNAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
BEGIN_ENTRY_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SEX: string;
@Column({
nullable: true,
type: "text",
default: null,
})
WORK_LINE_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SALARY: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DEPARTMENT_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DEPARTMENT_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DIVISION_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DIVISION_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SECTION_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SECTION_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
JOB_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
JOB_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CATEGORY_SAL_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SALARY_LEVEL_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
LEVEL_NAME: string;
}

View file

@ -0,0 +1,27 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_DISCIPLINE")
export class HR_DISCIPLINE {
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
@PrimaryGeneratedColumn()
id!: number;
@Column({
nullable: true,
type: "text",
default: null,
})
REASON_FLAW: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CREATE_DATE: string;
}

View file

@ -0,0 +1,27 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_DISCIPLINE_EMP")
export class HR_DISCIPLINE_EMP {
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
@PrimaryGeneratedColumn()
id!: number;
@Column({
nullable: true,
type: "text",
default: null,
})
REASON_FLAW: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CREATE_DATE: string;
}

View file

@ -52,4 +52,25 @@ export class HR_EDUCATION_EMP {
default: null,
})
EDUCATION_SEQ: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FUND_COURSE_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
MAJOR_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_EDUCATION: string;
}

View file

@ -0,0 +1,69 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_INSIGNIA")
export class HR_INSIGNIA {
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
@PrimaryGeneratedColumn()
id!: number;
@Column({
nullable: true,
type: "text",
default: null,
})
DECORATION_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CREATE_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
PERMISSION_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
BOOK: string;
@Column({
nullable: true,
type: "text",
default: null,
})
PART: string;
@Column({
nullable: true,
type: "text",
default: null,
})
PAGE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
ISSUE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DECORATIONS_NAME: string;
}

View file

@ -0,0 +1,62 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_INSIGNIA_EMP")
export class HR_INSIGNIA_EMP {
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
@PrimaryGeneratedColumn()
id!: number;
@Column({
nullable: true,
type: "text",
default: null,
})
DECORATION_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CREATE_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
BOOK: string;
@Column({
nullable: true,
type: "text",
default: null,
})
PART: string;
@Column({
nullable: true,
type: "text",
default: null,
})
PAGE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
ISSUE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DECORATIONS_NAME: string;
}

View file

@ -0,0 +1,191 @@
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("HR_POSITION_EMPLOYEE")
export class HR_POSITION_EMPLOYEE {
@PrimaryGeneratedColumn()
id!: number;
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_PERSON_TYPE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
ORDER_MOVE_POSITION: number;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_CODE_SIT: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_CODE_SIT_ABB: string;
@Column({
nullable: true,
default: null,
})
MP_COMMAND_NUM: number;
@Column({
nullable: true,
default: null,
})
CUR_YEAR: number;
@Column({
nullable: true,
default: null,
})
MP_COMMAND_DATE: string;
@Column({
nullable: true,
default: null,
})
MP_POS_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_TO_NAME_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_TO_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
WORK_LINE_NAME: string;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// MP_CEE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
JOB_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SECTION_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DIVISION_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DEPARTMENT_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DEPARTMENT_NAME: string;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// ADMIN_NAME: string;
@Column({
nullable: true,
default: null,
})
SALARY: number;
@Column({
nullable: true,
type: "text",
default: null,
})
REMARK: string;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// SAL_POS_AMOUNT_1: string;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// SAL_POS_AMOUNT_2: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SPECIAL_AMT: string;
@Column({
nullable: true,
type: "text",
default: null,
})
CATEGORY_SAL_CODE: string;
}

View file

@ -5,6 +5,27 @@ export class HR_POSITION_OFFICER {
@PrimaryGeneratedColumn()
id!: number;
@Column({
nullable: true,
type: "text",
default: null,
})
CIT: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_PERSON_TYPE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
ORDER_MOVE_POSITION: number;
@Column({
nullable: true,
type: "text",
@ -18,4 +39,146 @@ export class HR_POSITION_OFFICER {
default: null,
})
POS_NUM_CODE_SIT_ABB: string;
@Column({
nullable: true,
default: null,
})
MP_COMMAND_NUM: number;
@Column({
nullable: true,
default: null,
})
CUR_YEAR: number;
@Column({
nullable: true,
default: null,
})
MP_COMMAND_DATE: string;
@Column({
nullable: true,
default: null,
})
MP_POS_DATE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_TO_NAME_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_TO_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
POS_NUM_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
WORK_LINE_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
MP_CEE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
JOB_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SECTION_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DIVISION_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DEPARTMENT_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
DEPARTMENT_NAME: string;
@Column({
nullable: true,
type: "text",
default: null,
})
ADMIN_NAME: string;
@Column({
nullable: true,
default: null,
})
SALARY: number;
@Column({
nullable: true,
type: "text",
default: null,
})
REMARK: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SAL_POS_AMOUNT_1: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SAL_POS_AMOUNT_2: string;
@Column({
nullable: true,
type: "text",
default: null,
})
SPECIAL_AMT: string;
}

View file

@ -5,12 +5,12 @@ export class OFFICER {
@PrimaryGeneratedColumn()
id!: number;
// @Column({
// nullable: true,
// type: "text",
// default: null,
// })
// RET_YEAR: string;
@Column({
nullable: true,
type: "text",
default: null,
})
MP_CEE: string;
@Column({
nullable: true,

View file

@ -405,6 +405,14 @@ export class ProfileEmployee extends EntityBase {
})
posTypeNameTemp: string;
@Column({
nullable: true,
comment: "ประเภทชื่อย่อ",
length: 40,
default: null,
})
posTypeShortNameTemp: string;
@Column({
nullable: true,
comment: "id ระดับ",
@ -787,7 +795,7 @@ export class ProfileEmployee extends EntityBase {
@OneToMany(() => StateOperatorUser, (v) => v.profile)
stateOperatorUsers: StateOperatorUser[];
@OneToMany(() => PositionSalaryEditHistory, (v) => v.profileEmployee)
positionSalaryEditHistory: PositionSalaryEditHistory[];

View file

@ -24,7 +24,9 @@ export class ProfileInsignia extends EntityBase {
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ปีที่ยื่นขอ",
default: null,
})
year: number;

View file

@ -5,7 +5,11 @@ import { Insignia } from "./Insignia";
@Entity("profileInsigniaHistory")
export class ProfileInsigniaHistory extends EntityBase {
@Column({ comment: "ปีที่ยื่นขอ" })
@Column({
nullable: true,
comment: "ปีที่ยื่นขอ",
default: null,
})
year: number;
@Column({ nullable: true, length: 20, comment: "ลำดับที่", default: null })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long