fix remove await and addLogSequence of exprofile system
This commit is contained in:
parent
66d8ba089d
commit
6c31cd42c0
5 changed files with 186 additions and 171 deletions
|
|
@ -235,7 +235,7 @@ export class CommandController extends Controller {
|
||||||
? _data.child1[0] != null
|
? _data.child1[0] != null
|
||||||
? `current_holders.orgChild1Id IN (:...child1)`
|
? `current_holders.orgChild1Id IN (:...child1)`
|
||||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||||
`current_holders.orgChild1Id is null`
|
`current_holders.orgChild1Id is null`
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
child1: _data.child1,
|
child1: _data.child1,
|
||||||
|
|
@ -313,7 +313,7 @@ export class CommandController extends Controller {
|
||||||
status == null || status == undefined || status == ""
|
status == null || status == undefined || status == ""
|
||||||
? null
|
? null
|
||||||
: status.trim().toLocaleUpperCase() == "NEW" ||
|
: status.trim().toLocaleUpperCase() == "NEW" ||
|
||||||
status.trim().toLocaleUpperCase() == "DRAFT"
|
status.trim().toLocaleUpperCase() == "DRAFT"
|
||||||
? ["NEW", "DRAFT"]
|
? ["NEW", "DRAFT"]
|
||||||
: [status.trim().toLocaleUpperCase()],
|
: [status.trim().toLocaleUpperCase()],
|
||||||
},
|
},
|
||||||
|
|
@ -814,8 +814,8 @@ export class CommandController extends Controller {
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
refIds: [commandRecive.refId],
|
refIds: [commandRecive.refId],
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
const commandId = commandRecive.commandId;
|
const commandId = commandRecive.commandId;
|
||||||
await this.commandReciveRepository.delete(commandRecive.id);
|
await this.commandReciveRepository.delete(commandRecive.id);
|
||||||
|
|
@ -858,8 +858,8 @@ export class CommandController extends Controller {
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
refIds: [commandRecive.refId],
|
refIds: [commandRecive.refId],
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
const commandId = commandRecive.commandId;
|
const commandId = commandRecive.commandId;
|
||||||
await this.commandReciveRepository.delete(commandRecive.id);
|
await this.commandReciveRepository.delete(commandRecive.id);
|
||||||
|
|
@ -902,8 +902,8 @@ export class CommandController extends Controller {
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
refIds: [commandRecive.refId],
|
refIds: [commandRecive.refId],
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
const commandId = commandRecive.commandId;
|
const commandId = commandRecive.commandId;
|
||||||
await this.commandReciveRepository.delete(commandRecive.id);
|
await this.commandReciveRepository.delete(commandRecive.id);
|
||||||
|
|
@ -1187,8 +1187,8 @@ export class CommandController extends Controller {
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
refIds: command.commandRecives.map((x) => x.refId),
|
refIds: command.commandRecives.map((x) => x.refId),
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
await this.commandReciveRepository.delete({ commandId: command.id });
|
await this.commandReciveRepository.delete({ commandId: command.id });
|
||||||
command.status = "CANCEL";
|
command.status = "CANCEL";
|
||||||
|
|
@ -1253,8 +1253,8 @@ export class CommandController extends Controller {
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
refIds: command.commandRecives.map((x) => x.refId),
|
refIds: command.commandRecives.map((x) => x.refId),
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
await this.commandSendCCRepository.delete({ commandSendId: In(commandSend.map((x) => x.id)) });
|
await this.commandSendCCRepository.delete({ commandSendId: In(commandSend.map((x) => x.id)) });
|
||||||
await this.commandReciveRepository.delete({ commandId: command.id });
|
await this.commandReciveRepository.delete({ commandId: command.id });
|
||||||
|
|
@ -1407,11 +1407,11 @@ export class CommandController extends Controller {
|
||||||
let profiles =
|
let profiles =
|
||||||
command && command.commandRecives.length > 0
|
command && command.commandRecives.length > 0
|
||||||
? command.commandRecives
|
? command.commandRecives
|
||||||
.filter((x) => x.profileId != null)
|
.filter((x) => x.profileId != null)
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
receiverUserId: x.profileId,
|
receiverUserId: x.profileId,
|
||||||
notiLink: "",
|
notiLink: "",
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const msgNoti = {
|
const msgNoti = {
|
||||||
|
|
@ -1443,8 +1443,8 @@ export class CommandController extends Controller {
|
||||||
refIds: command.commandRecives.filter((x) => x.refId != null).map((x) => x.refId),
|
refIds: command.commandRecives.filter((x) => x.refId != null).map((x) => x.refId),
|
||||||
status: "WAITING",
|
status: "WAITING",
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
await this.commandRepository.save(command);
|
await this.commandRepository.save(command);
|
||||||
} else {
|
} else {
|
||||||
const path = commandTypePath(command.commandType.code);
|
const path = commandTypePath(command.commandType.code);
|
||||||
|
|
@ -1581,7 +1581,7 @@ export class CommandController extends Controller {
|
||||||
);
|
);
|
||||||
await this.profileRepository.save(profiles);
|
await this.profileRepository.save(profiles);
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch {}
|
||||||
|
|
||||||
type = "EMPLOYEE";
|
type = "EMPLOYEE";
|
||||||
try {
|
try {
|
||||||
|
|
@ -1613,7 +1613,7 @@ export class CommandController extends Controller {
|
||||||
);
|
);
|
||||||
await this.profileEmployeeRepository.save(profiles);
|
await this.profileEmployeeRepository.save(profiles);
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch {}
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -1677,7 +1677,7 @@ export class CommandController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch {}
|
||||||
|
|
||||||
type = "EMPLOYEE";
|
type = "EMPLOYEE";
|
||||||
try {
|
try {
|
||||||
|
|
@ -1732,7 +1732,7 @@ export class CommandController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch {}
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -1945,7 +1945,7 @@ export class CommandController extends Controller {
|
||||||
.then((x) => {
|
.then((x) => {
|
||||||
res = x;
|
res = x;
|
||||||
})
|
})
|
||||||
.catch((x) => { });
|
.catch((x) => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
let _command;
|
let _command;
|
||||||
|
|
@ -2023,76 +2023,76 @@ export class CommandController extends Controller {
|
||||||
profile?.current_holders.length == 0
|
profile?.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
|
||||||
null &&
|
null &&
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||||
?.orgChild4 != null
|
?.orgChild4 != null
|
||||||
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild4.orgChild4ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild4.orgChild4ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
|
||||||
null &&
|
null &&
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||||
?.orgChild3 != null
|
?.orgChild3 != null
|
||||||
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild3.orgChild3ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild3.orgChild3ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
||||||
: profile?.current_holders.find(
|
: profile?.current_holders.find(
|
||||||
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
|
||||||
) != null &&
|
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
|
||||||
?.orgChild2 != null
|
|
||||||
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild2.orgChild2ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
|
||||||
: profile?.current_holders.find(
|
|
||||||
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
|
||||||
) != null &&
|
|
||||||
profile?.current_holders.find(
|
|
||||||
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
|
||||||
)?.orgChild1 != null
|
|
||||||
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild1.orgChild1ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
|
||||||
: profile?.current_holders.find(
|
|
||||||
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
||||||
) != null &&
|
) != null &&
|
||||||
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||||
|
?.orgChild2 != null
|
||||||
|
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild2.orgChild2ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
||||||
|
: profile?.current_holders.find(
|
||||||
|
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
||||||
|
) != null &&
|
||||||
profile?.current_holders.find(
|
profile?.current_holders.find(
|
||||||
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
||||||
)?.orgRoot != null
|
)?.orgChild1 != null
|
||||||
|
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgChild1.orgChild1ShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
||||||
|
: profile?.current_holders.find(
|
||||||
|
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
||||||
|
) != null &&
|
||||||
|
profile?.current_holders.find(
|
||||||
|
(x) => x.orgRevisionId == orgRevisionActive?.id,
|
||||||
|
)?.orgRoot != null
|
||||||
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgRoot.orgRootShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
? `${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.orgRoot.orgRootShortName} ${profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)?.posMasterNo}`
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const root =
|
const root =
|
||||||
profile?.current_holders == null ||
|
profile?.current_holders == null ||
|
||||||
profile?.current_holders.length == 0 ||
|
profile?.current_holders.length == 0 ||
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||||
? null
|
? null
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||||
?.orgRoot;
|
?.orgRoot;
|
||||||
|
|
||||||
const child1 =
|
const child1 =
|
||||||
profile?.current_holders == null ||
|
profile?.current_holders == null ||
|
||||||
profile?.current_holders.length == 0 ||
|
profile?.current_holders.length == 0 ||
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||||
? null
|
? null
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||||
?.orgChild1;
|
?.orgChild1;
|
||||||
|
|
||||||
const child2 =
|
const child2 =
|
||||||
profile?.current_holders == null ||
|
profile?.current_holders == null ||
|
||||||
profile?.current_holders.length == 0 ||
|
profile?.current_holders.length == 0 ||
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||||
? null
|
? null
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||||
?.orgChild2;
|
?.orgChild2;
|
||||||
|
|
||||||
const child3 =
|
const child3 =
|
||||||
profile?.current_holders == null ||
|
profile?.current_holders == null ||
|
||||||
profile?.current_holders.length == 0 ||
|
profile?.current_holders.length == 0 ||
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||||
? null
|
? null
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||||
?.orgChild3;
|
?.orgChild3;
|
||||||
|
|
||||||
const child4 =
|
const child4 =
|
||||||
profile?.current_holders == null ||
|
profile?.current_holders == null ||
|
||||||
profile?.current_holders.length == 0 ||
|
profile?.current_holders.length == 0 ||
|
||||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||||
? null
|
? null
|
||||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||||
?.orgChild4;
|
?.orgChild4;
|
||||||
|
|
||||||
let _root = root?.orgRootName;
|
let _root = root?.orgRootName;
|
||||||
let _child1 = child1?.orgChild1Name;
|
let _child1 = child1?.orgChild1Name;
|
||||||
|
|
@ -2153,10 +2153,10 @@ export class CommandController extends Controller {
|
||||||
commandCode != "C-PM-21"
|
commandCode != "C-PM-21"
|
||||||
? profile?.isLeave == false
|
? profile?.isLeave == false
|
||||||
? (_child4 == null ? "" : _child4 + "\n") +
|
? (_child4 == null ? "" : _child4 + "\n") +
|
||||||
(_child3 == null ? "" : _child3 + "\n") +
|
(_child3 == null ? "" : _child3 + "\n") +
|
||||||
(_child2 == null ? "" : _child2 + "\n") +
|
(_child2 == null ? "" : _child2 + "\n") +
|
||||||
(_child1 == null ? "" : _child1 + "\n") +
|
(_child1 == null ? "" : _child1 + "\n") +
|
||||||
(_root == null ? "" : _root)
|
(_root == null ? "" : _root)
|
||||||
: orgLeave
|
: orgLeave
|
||||||
: profileTemp.org,
|
: profileTemp.org,
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
|
|
@ -2171,8 +2171,8 @@ export class CommandController extends Controller {
|
||||||
commandCode != "C-PM-21"
|
commandCode != "C-PM-21"
|
||||||
? profile?.posType && profile?.posLevel
|
? profile?.posType && profile?.posLevel
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
|
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
|
||||||
)
|
)
|
||||||
: "-"
|
: "-"
|
||||||
: Extension.ToThaiNumber(profileTemp.posLevel),
|
: Extension.ToThaiNumber(profileTemp.posLevel),
|
||||||
posNo:
|
posNo:
|
||||||
|
|
@ -2186,19 +2186,19 @@ export class CommandController extends Controller {
|
||||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile?.dateRetire))
|
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile?.dateRetire))
|
||||||
: profile?.birthDate && commandCode == "C-PM-21"
|
: profile?.birthDate && commandCode == "C-PM-21"
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
Extension.ToThaiShortDate_monthYear(
|
Extension.ToThaiShortDate_monthYear(
|
||||||
new Date(
|
new Date(
|
||||||
profile.birthDate.getFullYear() + 60,
|
profile.birthDate.getFullYear() + 60,
|
||||||
profile.birthDate.getMonth(),
|
profile.birthDate.getMonth(),
|
||||||
profile.birthDate.getDate(),
|
profile.birthDate.getDate(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
: "-",
|
: "-",
|
||||||
dateExecute: command.commandExcecuteDate
|
dateExecute: command.commandExcecuteDate
|
||||||
? Extension.ToThaiNumber(
|
? Extension.ToThaiNumber(
|
||||||
Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),
|
Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),
|
||||||
)
|
)
|
||||||
: "-",
|
: "-",
|
||||||
remark: x.remarkVertical ? x.remarkVertical : "-",
|
remark: x.remarkVertical ? x.remarkVertical : "-",
|
||||||
};
|
};
|
||||||
|
|
@ -2299,7 +2299,7 @@ export class CommandController extends Controller {
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
_command = res;
|
_command = res;
|
||||||
})
|
})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
let issue =
|
let issue =
|
||||||
command.isBangkok == "OFFICE"
|
command.isBangkok == "OFFICE"
|
||||||
|
|
@ -2357,15 +2357,15 @@ export class CommandController extends Controller {
|
||||||
operators:
|
operators:
|
||||||
operators.length > 0
|
operators.length > 0
|
||||||
? operators.map((x) => ({
|
? operators.map((x) => ({
|
||||||
fullName: `${x.prefix ?? ""}${x.firstName ?? ""} ${x.lastName ?? ""}`,
|
fullName: `${x.prefix ?? ""}${x.firstName ?? ""} ${x.lastName ?? ""}`,
|
||||||
roleName: x.roleName,
|
roleName: x.roleName,
|
||||||
}))
|
}))
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
fullName: "",
|
fullName: "",
|
||||||
roleName: "เจ้าหน้าที่ดำเนินการ",
|
roleName: "เจ้าหน้าที่ดำเนินการ",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -2497,12 +2497,12 @@ export class CommandController extends Controller {
|
||||||
@Put("change-creator/{id}")
|
@Put("change-creator/{id}")
|
||||||
async ChangeCreator(
|
async ChangeCreator(
|
||||||
@Path() id: string,
|
@Path() id: string,
|
||||||
@Body() req: { assignId: string; },
|
@Body() req: { assignId: string },
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
) {
|
) {
|
||||||
await new permission().PermissionUpdate(request, "COMMAND");
|
await new permission().PermissionUpdate(request, "COMMAND");
|
||||||
const command = await this.commandRepository.findOne({
|
const command = await this.commandRepository.findOne({
|
||||||
where: { id: id }
|
where: { id: id },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
|
|
@ -2704,8 +2704,8 @@ export class CommandController extends Controller {
|
||||||
refIds: requestBody.persons.filter((x) => x.refId != null).map((x) => x.refId),
|
refIds: requestBody.persons.filter((x) => x.refId != null).map((x) => x.refId),
|
||||||
status: "REPORT",
|
status: "REPORT",
|
||||||
})
|
})
|
||||||
.then(async (res) => { })
|
.then(async (res) => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
let order =
|
let order =
|
||||||
command.commandRecives == null || command.commandRecives.length <= 0
|
command.commandRecives == null || command.commandRecives.length <= 0
|
||||||
? 0
|
? 0
|
||||||
|
|
@ -3478,27 +3478,27 @@ export class CommandController extends Controller {
|
||||||
? x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
|
? x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
|
||||||
: x.orgChild3 == null
|
: x.orgChild3 == null
|
||||||
? x.orgChild2.orgChild2Name +
|
? x.orgChild2.orgChild2Name +
|
||||||
"\n" +
|
|
||||||
x.orgChild1.orgChild1Name +
|
|
||||||
"\n" +
|
|
||||||
x.orgRoot.orgRootName
|
|
||||||
: x.orgChild4 == null
|
|
||||||
? x.orgChild3.orgChild3Name +
|
|
||||||
"\n" +
|
|
||||||
x.orgChild2.orgChild2Name +
|
|
||||||
"\n" +
|
"\n" +
|
||||||
x.orgChild1.orgChild1Name +
|
x.orgChild1.orgChild1Name +
|
||||||
"\n" +
|
"\n" +
|
||||||
x.orgRoot.orgRootName
|
x.orgRoot.orgRootName
|
||||||
|
: x.orgChild4 == null
|
||||||
|
? x.orgChild3.orgChild3Name +
|
||||||
|
"\n" +
|
||||||
|
x.orgChild2.orgChild2Name +
|
||||||
|
"\n" +
|
||||||
|
x.orgChild1.orgChild1Name +
|
||||||
|
"\n" +
|
||||||
|
x.orgRoot.orgRootName
|
||||||
: x.orgChild4.orgChild4Name +
|
: x.orgChild4.orgChild4Name +
|
||||||
"\n" +
|
"\n" +
|
||||||
x.orgChild3.orgChild3Name +
|
x.orgChild3.orgChild3Name +
|
||||||
"\n" +
|
"\n" +
|
||||||
x.orgChild2.orgChild2Name +
|
x.orgChild2.orgChild2Name +
|
||||||
"\n" +
|
"\n" +
|
||||||
x.orgChild1.orgChild1Name +
|
x.orgChild1.orgChild1Name +
|
||||||
"\n" +
|
"\n" +
|
||||||
x.orgRoot.orgRootName,
|
x.orgRoot.orgRootName,
|
||||||
positionName: x?.current_holder.position ?? _null,
|
positionName: x?.current_holder.position ?? _null,
|
||||||
profileId: x?.current_holder.id ?? _null,
|
profileId: x?.current_holder.id ?? _null,
|
||||||
});
|
});
|
||||||
|
|
@ -4019,7 +4019,7 @@ export class CommandController extends Controller {
|
||||||
.orgRootShortName ?? "";
|
.orgRootShortName ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const today = new Date().setHours(0,0,0,0);
|
const today = new Date().setHours(0, 0, 0, 0);
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
const profile = await this.profileRepository.findOne({
|
const profile = await this.profileRepository.findOne({
|
||||||
|
|
@ -4046,10 +4046,13 @@ export class CommandController extends Controller {
|
||||||
relations: { command: true },
|
relations: { command: true },
|
||||||
});
|
});
|
||||||
const executeDate = commandResign
|
const executeDate = commandResign
|
||||||
? new Date(commandResign.command.commandExcecuteDate).setHours(0,0,0,0)
|
? new Date(commandResign.command.commandExcecuteDate).setHours(0, 0, 0, 0)
|
||||||
: today;
|
: today;
|
||||||
if (commandResign && _command.status !== "REPORTED" &&
|
if (
|
||||||
(_command.status !== "WAITING" || today < executeDate)) {
|
commandResign &&
|
||||||
|
_command.status !== "REPORTED" &&
|
||||||
|
(_command.status !== "WAITING" || today < executeDate)
|
||||||
|
) {
|
||||||
await reOrderCommandRecivesAndDelete(commandResign!.id);
|
await reOrderCommandRecivesAndDelete(commandResign!.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4322,6 +4325,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
req,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
@ -4425,7 +4429,7 @@ export class CommandController extends Controller {
|
||||||
.orgRootShortName ?? "";
|
.orgRootShortName ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const today = new Date().setHours(0,0,0,0);
|
const today = new Date().setHours(0, 0, 0, 0);
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
const profile = await this.profileEmployeeRepository.findOne({
|
const profile = await this.profileEmployeeRepository.findOne({
|
||||||
|
|
@ -4448,10 +4452,13 @@ export class CommandController extends Controller {
|
||||||
relations: { command: true },
|
relations: { command: true },
|
||||||
});
|
});
|
||||||
const executeDate = commandResign
|
const executeDate = commandResign
|
||||||
? new Date(commandResign.command.commandExcecuteDate).setHours(0,0,0,0)
|
? new Date(commandResign.command.commandExcecuteDate).setHours(0, 0, 0, 0)
|
||||||
: today;
|
: today;
|
||||||
if (commandResign && _command.status !== "REPORTED" &&
|
if (
|
||||||
(_command.status !== "WAITING" || today < executeDate)) {
|
commandResign &&
|
||||||
|
_command.status !== "REPORTED" &&
|
||||||
|
(_command.status !== "WAITING" || today < executeDate)
|
||||||
|
) {
|
||||||
await reOrderCommandRecivesAndDelete(commandResign!.id);
|
await reOrderCommandRecivesAndDelete(commandResign!.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4572,7 +4579,8 @@ export class CommandController extends Controller {
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
organizeName = names.join(" ");
|
organizeName = names.join(" ");
|
||||||
}
|
}
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
req,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
@ -4842,7 +4850,8 @@ export class CommandController extends Controller {
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
organizeName = names.join(" ");
|
organizeName = names.join(" ");
|
||||||
}
|
}
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
req,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
@ -5473,7 +5482,8 @@ export class CommandController extends Controller {
|
||||||
? `${profile.posLevel?.posLevelName}`
|
? `${profile.posLevel?.posLevelName}`
|
||||||
: `${profile.posType?.posTypeName} ${profile.posLevel?.posLevelName}`;
|
: `${profile.posType?.posTypeName} ${profile.posLevel?.posLevelName}`;
|
||||||
|
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
req,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
@ -6126,26 +6136,26 @@ export class CommandController extends Controller {
|
||||||
!profile.current_holders || profile.current_holders.length == 0
|
!profile.current_holders || profile.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||||
?.orgChild4 != null
|
?.orgChild4 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||||
?.orgChild3 != null
|
?.orgChild3 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||||
?.orgChild2 != null
|
?.orgChild2 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
|
||||||
null &&
|
null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||||
?.orgChild1 != null
|
?.orgChild1 != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}`
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
|
||||||
null &&
|
null &&
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||||
?.orgRoot != null
|
?.orgRoot != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
||||||
: null;
|
: null;
|
||||||
const posNo = `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`;
|
const posNo = `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`;
|
||||||
|
|
@ -6249,7 +6259,8 @@ export class CommandController extends Controller {
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
organizeName = names.join(" ");
|
organizeName = names.join(" ");
|
||||||
}
|
}
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
req,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
@ -6976,8 +6987,8 @@ export class CommandController extends Controller {
|
||||||
prefix: avatar,
|
prefix: avatar,
|
||||||
fileName: fileName,
|
fileName: fileName,
|
||||||
})
|
})
|
||||||
.then(() => { })
|
.then(() => {})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -8088,7 +8099,7 @@ export class CommandController extends Controller {
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
_command = res;
|
_command = res;
|
||||||
})
|
})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
|
|
||||||
let issue =
|
let issue =
|
||||||
command.isBangkok == "OFFICE"
|
command.isBangkok == "OFFICE"
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import {
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatusCode from "../interfaces/http-status";
|
import HttpStatusCode from "../interfaces/http-status";
|
||||||
|
import { addLogSequence } from "../interfaces/utils";
|
||||||
|
|
||||||
interface CachedToken {
|
interface CachedToken {
|
||||||
token: string;
|
token: string;
|
||||||
|
|
@ -171,6 +172,7 @@ async function getToken(ClientID: string, ClientSecret: string): Promise<string>
|
||||||
|
|
||||||
// function post retire data to exprofile system
|
// function post retire data to exprofile system
|
||||||
export async function PostRetireToExprofile(
|
export async function PostRetireToExprofile(
|
||||||
|
request: any,
|
||||||
citizenID: string,
|
citizenID: string,
|
||||||
prefix: string,
|
prefix: string,
|
||||||
firstName: string,
|
firstName: string,
|
||||||
|
|
@ -225,19 +227,6 @@ export async function PostRetireToExprofile(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// addLogSequence(request, {
|
|
||||||
// action: "request",
|
|
||||||
// status: "success",
|
|
||||||
// description: "connected",
|
|
||||||
// request: {
|
|
||||||
// method: "POST",
|
|
||||||
// url: url,
|
|
||||||
// payload: JSON.stringify(sendData),
|
|
||||||
// response: JSON.stringify(response.data.result),
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.response?.status === 500 && retryCount < maxRetries - 1) {
|
if (error.response?.status === 500 && retryCount < maxRetries - 1) {
|
||||||
|
|
@ -245,6 +234,18 @@ export async function PostRetireToExprofile(
|
||||||
retryCount++;
|
retryCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addLogSequence(request, {
|
||||||
|
action: "request",
|
||||||
|
status: "error",
|
||||||
|
description: "unconnected to exprofile api",
|
||||||
|
request: {
|
||||||
|
method: "POST",
|
||||||
|
url: API_URL_BANGKOK + "/importData",
|
||||||
|
response: JSON.stringify(error),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ไม่สามารถติดต่อ API ได้");
|
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ไม่สามารถติดต่อ API ได้");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11013,7 +11013,8 @@ export class ProfileController extends Controller {
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
organizeName = names.join(" ");
|
organizeName = names.join(" ");
|
||||||
}
|
}
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
request,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
|
||||||
|
|
@ -2290,13 +2290,13 @@ export class ProfileEmployeeController extends Controller {
|
||||||
@Get("history/user")
|
@Get("history/user")
|
||||||
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { keycloak: request.user.sub }
|
where: { keycloak: request.user.sub },
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const profileHistory = await this.profileHistoryRepo.find({
|
const profileHistory = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profile.id },
|
where: { profileEmployeeId: profile.id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (profileHistory.length == 0) {
|
if (profileHistory.length == 0) {
|
||||||
|
|
@ -2305,12 +2305,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
...profile,
|
...profile,
|
||||||
birthDateOld: profile?.birthDate,
|
birthDateOld: profile?.birthDate,
|
||||||
profileEmployeeId: profile.id,
|
profileEmployeeId: profile.id,
|
||||||
id: undefined
|
id: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const firstRecord = await this.profileHistoryRepo.find({
|
const firstRecord = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profile.id },
|
where: { profileEmployeeId: profile.id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(firstRecord);
|
return new HttpSuccess(firstRecord);
|
||||||
}
|
}
|
||||||
|
|
@ -3207,13 +3207,13 @@ export class ProfileEmployeeController extends Controller {
|
||||||
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
||||||
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); ไม่แน่ใจEMPปิดไว้ก่อน;
|
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); ไม่แน่ใจEMPปิดไว้ก่อน;
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { id: id }
|
where: { id: id },
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const profileHistory = await this.profileHistoryRepo.find({
|
const profileHistory = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (profileHistory.length == 0) {
|
if (profileHistory.length == 0) {
|
||||||
|
|
@ -3222,12 +3222,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
...profile,
|
...profile,
|
||||||
birthDateOld: profile?.birthDate,
|
birthDateOld: profile?.birthDate,
|
||||||
profileEmployeeId: id,
|
profileEmployeeId: id,
|
||||||
id: undefined
|
id: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const firstRecord = await this.profileHistoryRepo.find({
|
const firstRecord = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(firstRecord);
|
return new HttpSuccess(firstRecord);
|
||||||
}
|
}
|
||||||
|
|
@ -5450,7 +5450,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
organizeName = names.join(" ");
|
organizeName = names.join(" ");
|
||||||
}
|
}
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
request,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
|
||||||
|
|
@ -1295,13 +1295,13 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
@Get("history/user")
|
@Get("history/user")
|
||||||
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { keycloak: request.user.sub }
|
where: { keycloak: request.user.sub },
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const profileHistory = await this.profileHistoryRepo.find({
|
const profileHistory = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profile.id },
|
where: { profileEmployeeId: profile.id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (profileHistory.length == 0) {
|
if (profileHistory.length == 0) {
|
||||||
|
|
@ -1310,12 +1310,12 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
...profile,
|
...profile,
|
||||||
birthDateOld: profile?.birthDate,
|
birthDateOld: profile?.birthDate,
|
||||||
profileEmployeeId: profile.id,
|
profileEmployeeId: profile.id,
|
||||||
id: undefined
|
id: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const firstRecord = await this.profileHistoryRepo.find({
|
const firstRecord = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profile.id },
|
where: { profileEmployeeId: profile.id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(firstRecord);
|
return new HttpSuccess(firstRecord);
|
||||||
}
|
}
|
||||||
|
|
@ -1828,13 +1828,13 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
async getProfileHistory(@Path() id: string, @Request() req: RequestWithUser) {
|
||||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
|
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { id: id }
|
where: { id: id },
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const profileHistory = await this.profileHistoryRepo.find({
|
const profileHistory = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (profileHistory.length == 0) {
|
if (profileHistory.length == 0) {
|
||||||
|
|
@ -1843,12 +1843,12 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
...profile,
|
...profile,
|
||||||
birthDateOld: profile?.birthDate,
|
birthDateOld: profile?.birthDate,
|
||||||
profileEmployeeId: id,
|
profileEmployeeId: id,
|
||||||
id: undefined
|
id: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const firstRecord = await this.profileHistoryRepo.find({
|
const firstRecord = await this.profileHistoryRepo.find({
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
order: { createdAt: "ASC" }
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(firstRecord);
|
return new HttpSuccess(firstRecord);
|
||||||
}
|
}
|
||||||
|
|
@ -3606,7 +3606,8 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
organizeName = names.join(" ");
|
organizeName = names.join(" ");
|
||||||
}
|
}
|
||||||
await PostRetireToExprofile(
|
PostRetireToExprofile(
|
||||||
|
request,
|
||||||
profile.citizenId ?? "",
|
profile.citizenId ?? "",
|
||||||
profile.prefix ?? "",
|
profile.prefix ?? "",
|
||||||
profile.firstName ?? "",
|
profile.firstName ?? "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue