closed#2190 post to exprofile if production only
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m24s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m24s
This commit is contained in:
parent
637e995915
commit
4e396b454d
5 changed files with 831 additions and 839 deletions
|
|
@ -99,7 +99,7 @@ import {
|
|||
CreatePosMasterHistoryOfficer,
|
||||
} from "../services/PositionService";
|
||||
import { PostRetireToExprofile } from "./ExRetirementController";
|
||||
import { LeaveType } from "../entities/LeaveType"
|
||||
import { LeaveType } from "../entities/LeaveType";
|
||||
@Route("api/v1/org/command")
|
||||
@Tags("Command")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -219,8 +219,8 @@ export class CommandController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -298,7 +298,7 @@ export class CommandController extends Controller {
|
|||
status == null || status == undefined || status == ""
|
||||
? null
|
||||
: status.trim().toLocaleUpperCase() == "NEW" ||
|
||||
status.trim().toLocaleUpperCase() == "DRAFT"
|
||||
status.trim().toLocaleUpperCase() == "DRAFT"
|
||||
? ["NEW", "DRAFT"]
|
||||
: [status.trim().toLocaleUpperCase()],
|
||||
},
|
||||
|
|
@ -428,7 +428,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
if (profile) {
|
||||
const currentHolder = profile!.current_holders?.find(
|
||||
x =>
|
||||
(x) =>
|
||||
x.orgRevision?.orgRevisionIsDraft === false &&
|
||||
x.orgRevision?.orgRevisionIsCurrent === true,
|
||||
);
|
||||
|
|
@ -457,29 +457,26 @@ export class CommandController extends Controller {
|
|||
order: { createdAt: "DESC" },
|
||||
relations: { posExecutive: true },
|
||||
});
|
||||
const operator = Object.assign(
|
||||
new CommandOperator(),
|
||||
{
|
||||
profileId: profile?.id,
|
||||
prefix: profile?.prefix,
|
||||
firstName: profile?.firstName,
|
||||
lastName: profile?.lastName,
|
||||
posNo: posNo,
|
||||
posType: profile?.posType?.posTypeName ?? null,
|
||||
posLevel: profile?.posLevel?.posLevelName ?? null,
|
||||
position: position?.positionName ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
roleName: "เจ้าหน้าที่ดำเนินการ",
|
||||
orderNo: 1,
|
||||
commandId: command.id,
|
||||
createdUserId: request.user.sub,
|
||||
createdFullName: request.user.name,
|
||||
createdAt: now,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
lastUpdatedAt: now,
|
||||
}
|
||||
);
|
||||
const operator = Object.assign(new CommandOperator(), {
|
||||
profileId: profile?.id,
|
||||
prefix: profile?.prefix,
|
||||
firstName: profile?.firstName,
|
||||
lastName: profile?.lastName,
|
||||
posNo: posNo,
|
||||
posType: profile?.posType?.posTypeName ?? null,
|
||||
posLevel: profile?.posLevel?.posLevelName ?? null,
|
||||
position: position?.positionName ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
roleName: "เจ้าหน้าที่ดำเนินการ",
|
||||
orderNo: 1,
|
||||
commandId: command.id,
|
||||
createdUserId: request.user.sub,
|
||||
createdFullName: request.user.name,
|
||||
createdAt: now,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
lastUpdatedAt: now,
|
||||
});
|
||||
await this.commandOperatorRepository.save(operator);
|
||||
}
|
||||
}
|
||||
|
|
@ -521,7 +518,7 @@ export class CommandController extends Controller {
|
|||
commandTypeName: command.commandType?.name || null,
|
||||
commandCode: command.commandType?.code || null,
|
||||
commandSysId: command.commandType?.commandSysId || null,
|
||||
createdUserId: command.createdUserId
|
||||
createdUserId: command.createdUserId,
|
||||
};
|
||||
return new HttpSuccess(_command);
|
||||
}
|
||||
|
|
@ -733,7 +730,7 @@ export class CommandController extends Controller {
|
|||
/**
|
||||
* API แก้ไขเงินเดือนทั้งกลุ่ม
|
||||
*
|
||||
* @summary API แก้ไขเงินเดือนทั้งกลุ่ม
|
||||
* @summary API แก้ไขเงินเดือนทั้งกลุ่ม
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
|
|
@ -802,8 +799,8 @@ export class CommandController extends Controller {
|
|||
.PostData(request, path + "/delete", {
|
||||
refIds: [commandRecive.refId],
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
|
||||
const commandId = commandRecive.commandId;
|
||||
await this.commandReciveRepository.delete(commandRecive.id);
|
||||
|
|
@ -846,8 +843,8 @@ export class CommandController extends Controller {
|
|||
.PostData(request, path + "/delete", {
|
||||
refIds: [commandRecive.refId],
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
|
||||
const commandId = commandRecive.commandId;
|
||||
await this.commandReciveRepository.delete(commandRecive.id);
|
||||
|
|
@ -890,8 +887,8 @@ export class CommandController extends Controller {
|
|||
.PostData(request, path + "/delete", {
|
||||
refIds: [commandRecive.refId],
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
|
||||
const commandId = commandRecive.commandId;
|
||||
await this.commandReciveRepository.delete(commandRecive.id);
|
||||
|
|
@ -1175,8 +1172,8 @@ export class CommandController extends Controller {
|
|||
.PostData(request, path + "/delete", {
|
||||
refIds: command.commandRecives.map((x) => x.refId),
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
|
||||
await this.commandReciveRepository.delete({ commandId: command.id });
|
||||
command.status = "CANCEL";
|
||||
|
|
@ -1241,8 +1238,8 @@ export class CommandController extends Controller {
|
|||
.PostData(request, path + "/delete", {
|
||||
refIds: command.commandRecives.map((x) => x.refId),
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
|
||||
await this.commandSendCCRepository.delete({ commandSendId: In(commandSend.map((x) => x.id)) });
|
||||
await this.commandReciveRepository.delete({ commandId: command.id });
|
||||
|
|
@ -1394,11 +1391,11 @@ export class CommandController extends Controller {
|
|||
let profiles =
|
||||
command && command.commandRecives.length > 0
|
||||
? command.commandRecives
|
||||
.filter((x) => x.profileId != null)
|
||||
.map((x) => ({
|
||||
receiverUserId: x.profileId,
|
||||
notiLink: "",
|
||||
}))
|
||||
.filter((x) => x.profileId != null)
|
||||
.map((x) => ({
|
||||
receiverUserId: x.profileId,
|
||||
notiLink: "",
|
||||
}))
|
||||
: [];
|
||||
|
||||
const msgNoti = {
|
||||
|
|
@ -1430,8 +1427,8 @@ export class CommandController extends Controller {
|
|||
refIds: command.commandRecives.filter((x) => x.refId != null).map((x) => x.refId),
|
||||
status: "WAITING",
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
await this.commandRepository.save(command);
|
||||
} else {
|
||||
const path = commandTypePath(command.commandType.code);
|
||||
|
|
@ -1568,7 +1565,7 @@ export class CommandController extends Controller {
|
|||
);
|
||||
await this.profileRepository.save(profiles);
|
||||
}
|
||||
} catch { }
|
||||
} catch {}
|
||||
|
||||
type = "EMPLOYEE";
|
||||
try {
|
||||
|
|
@ -1600,7 +1597,7 @@ export class CommandController extends Controller {
|
|||
);
|
||||
await this.profileEmployeeRepository.save(profiles);
|
||||
}
|
||||
} catch { }
|
||||
} catch {}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -1664,7 +1661,7 @@ export class CommandController extends Controller {
|
|||
}),
|
||||
);
|
||||
}
|
||||
} catch { }
|
||||
} catch {}
|
||||
|
||||
type = "EMPLOYEE";
|
||||
try {
|
||||
|
|
@ -1719,7 +1716,7 @@ export class CommandController extends Controller {
|
|||
}),
|
||||
);
|
||||
}
|
||||
} catch { }
|
||||
} catch {}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -1932,7 +1929,7 @@ export class CommandController extends Controller {
|
|||
.then((x) => {
|
||||
res = x;
|
||||
})
|
||||
.catch((x) => { });
|
||||
.catch((x) => {});
|
||||
}
|
||||
|
||||
let _command;
|
||||
|
|
@ -2010,76 +2007,76 @@ export class CommandController extends Controller {
|
|||
profile?.current_holders.length == 0
|
||||
? null
|
||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id) !=
|
||||
null &&
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||
?.orgChild4 != null
|
||||
null &&
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||
?.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) !=
|
||||
null &&
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||
?.orgChild3 != null
|
||||
null &&
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive?.id)
|
||||
?.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,
|
||||
) != 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,
|
||||
) != 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,
|
||||
)?.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}`
|
||||
: null;
|
||||
|
||||
const root =
|
||||
profile?.current_holders == null ||
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
? null
|
||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgRoot;
|
||||
?.orgRoot;
|
||||
|
||||
const child1 =
|
||||
profile?.current_holders == null ||
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
? null
|
||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild1;
|
||||
?.orgChild1;
|
||||
|
||||
const child2 =
|
||||
profile?.current_holders == null ||
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
? null
|
||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild2;
|
||||
?.orgChild2;
|
||||
|
||||
const child3 =
|
||||
profile?.current_holders == null ||
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
? null
|
||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild3;
|
||||
?.orgChild3;
|
||||
|
||||
const child4 =
|
||||
profile?.current_holders == null ||
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
profile?.current_holders.length == 0 ||
|
||||
profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) == null
|
||||
? null
|
||||
: profile?.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild4;
|
||||
?.orgChild4;
|
||||
|
||||
let _root = root?.orgRootName;
|
||||
let _child1 = child1?.orgChild1Name;
|
||||
|
|
@ -2140,10 +2137,10 @@ export class CommandController extends Controller {
|
|||
commandCode != "C-PM-21"
|
||||
? profile?.isLeave == false
|
||||
? (_child4 == null ? "" : _child4 + "\n") +
|
||||
(_child3 == null ? "" : _child3 + "\n") +
|
||||
(_child2 == null ? "" : _child2 + "\n") +
|
||||
(_child1 == null ? "" : _child1 + "\n") +
|
||||
(_root == null ? "" : _root)
|
||||
(_child3 == null ? "" : _child3 + "\n") +
|
||||
(_child2 == null ? "" : _child2 + "\n") +
|
||||
(_child1 == null ? "" : _child1 + "\n") +
|
||||
(_root == null ? "" : _root)
|
||||
: orgLeave
|
||||
: profileTemp.org,
|
||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||
|
|
@ -2158,8 +2155,8 @@ export class CommandController extends Controller {
|
|||
commandCode != "C-PM-21"
|
||||
? profile?.posType && profile?.posLevel
|
||||
? Extension.ToThaiNumber(
|
||||
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
|
||||
)
|
||||
`${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`,
|
||||
)
|
||||
: "-"
|
||||
: Extension.ToThaiNumber(profileTemp.posLevel),
|
||||
posNo:
|
||||
|
|
@ -2173,19 +2170,19 @@ export class CommandController extends Controller {
|
|||
? 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(
|
||||
Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),
|
||||
)
|
||||
Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),
|
||||
)
|
||||
: "-",
|
||||
remark: x.remarkVertical ? x.remarkVertical : "-",
|
||||
};
|
||||
|
|
@ -2286,7 +2283,7 @@ export class CommandController extends Controller {
|
|||
.then(async (res) => {
|
||||
_command = res;
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
|
||||
let issue =
|
||||
command.isBangkok == "OFFICE"
|
||||
|
|
@ -2320,7 +2317,7 @@ export class CommandController extends Controller {
|
|||
firstName: true,
|
||||
lastName: true,
|
||||
roleName: true,
|
||||
orderNo: true
|
||||
orderNo: true,
|
||||
},
|
||||
where: { commandId: command.id },
|
||||
order: { orderNo: "ASC" },
|
||||
|
|
@ -2341,15 +2338,18 @@ export class CommandController extends Controller {
|
|||
command.commandExcecuteDate == null
|
||||
? ""
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandExcecuteDate)),
|
||||
operators: operators.length > 0
|
||||
? operators.map(x => ({
|
||||
fullName: `${x.prefix ?? ""}${x.firstName ?? ""} ${x.lastName ?? ""}`,
|
||||
roleName: x.roleName
|
||||
}))
|
||||
: [{
|
||||
fullName: "",
|
||||
roleName: "เจ้าหน้าที่ดำเนินการ"
|
||||
}]
|
||||
operators:
|
||||
operators.length > 0
|
||||
? operators.map((x) => ({
|
||||
fullName: `${x.prefix ?? ""}${x.firstName ?? ""} ${x.lastName ?? ""}`,
|
||||
roleName: x.roleName,
|
||||
}))
|
||||
: [
|
||||
{
|
||||
fullName: "",
|
||||
roleName: "เจ้าหน้าที่ดำเนินการ",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -2594,7 +2594,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
if (profile) {
|
||||
const currentHolder = profile!.current_holders?.find(
|
||||
x =>
|
||||
(x) =>
|
||||
x.orgRevision?.orgRevisionIsDraft === false &&
|
||||
x.orgRevision?.orgRevisionIsCurrent === true,
|
||||
);
|
||||
|
|
@ -2623,29 +2623,26 @@ export class CommandController extends Controller {
|
|||
order: { createdAt: "DESC" },
|
||||
relations: { posExecutive: true },
|
||||
});
|
||||
const operator = Object.assign(
|
||||
new CommandOperator(),
|
||||
{
|
||||
profileId: profile?.id,
|
||||
prefix: profile?.prefix,
|
||||
firstName: profile?.firstName,
|
||||
lastName: profile?.lastName,
|
||||
posNo: posNo,
|
||||
posType: profile?.posType?.posTypeName ?? null,
|
||||
posLevel: profile?.posLevel?.posLevelName ?? null,
|
||||
position: position?.positionName ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
roleName: "เจ้าหน้าที่ดำเนินการ",
|
||||
orderNo: 1,
|
||||
commandId: command.id,
|
||||
createdUserId: request.user.sub,
|
||||
createdFullName: request.user.name,
|
||||
createdAt: now,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
lastUpdatedAt: now,
|
||||
}
|
||||
);
|
||||
const operator = Object.assign(new CommandOperator(), {
|
||||
profileId: profile?.id,
|
||||
prefix: profile?.prefix,
|
||||
firstName: profile?.firstName,
|
||||
lastName: profile?.lastName,
|
||||
posNo: posNo,
|
||||
posType: profile?.posType?.posTypeName ?? null,
|
||||
posLevel: profile?.posLevel?.posLevelName ?? null,
|
||||
position: position?.positionName ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
roleName: "เจ้าหน้าที่ดำเนินการ",
|
||||
orderNo: 1,
|
||||
commandId: command.id,
|
||||
createdUserId: request.user.sub,
|
||||
createdFullName: request.user.name,
|
||||
createdAt: now,
|
||||
lastUpdateUserId: request.user.sub,
|
||||
lastUpdateFullName: request.user.name,
|
||||
lastUpdatedAt: now,
|
||||
});
|
||||
await this.commandOperatorRepository.save(operator);
|
||||
}
|
||||
}
|
||||
|
|
@ -2657,8 +2654,8 @@ export class CommandController extends Controller {
|
|||
refIds: requestBody.persons.filter((x) => x.refId != null).map((x) => x.refId),
|
||||
status: "REPORT",
|
||||
})
|
||||
.then(async (res) => { })
|
||||
.catch(() => { });
|
||||
.then(async (res) => {})
|
||||
.catch(() => {});
|
||||
let order =
|
||||
command.commandRecives == null || command.commandRecives.length <= 0
|
||||
? 0
|
||||
|
|
@ -3431,27 +3428,27 @@ export class CommandController extends Controller {
|
|||
? x.orgChild1.orgChild1Name + "\n" + x.orgRoot.orgRootName
|
||||
: x.orgChild3 == null
|
||||
? x.orgChild2.orgChild2Name +
|
||||
"\n" +
|
||||
x.orgChild1.orgChild1Name +
|
||||
"\n" +
|
||||
x.orgRoot.orgRootName
|
||||
: x.orgChild4 == null
|
||||
? x.orgChild3.orgChild3Name +
|
||||
"\n" +
|
||||
x.orgChild2.orgChild2Name +
|
||||
"\n" +
|
||||
x.orgChild1.orgChild1Name +
|
||||
"\n" +
|
||||
x.orgRoot.orgRootName
|
||||
: x.orgChild4 == null
|
||||
? x.orgChild3.orgChild3Name +
|
||||
"\n" +
|
||||
x.orgChild2.orgChild2Name +
|
||||
"\n" +
|
||||
x.orgChild1.orgChild1Name +
|
||||
"\n" +
|
||||
x.orgRoot.orgRootName
|
||||
: x.orgChild4.orgChild4Name +
|
||||
"\n" +
|
||||
x.orgChild3.orgChild3Name +
|
||||
"\n" +
|
||||
x.orgChild2.orgChild2Name +
|
||||
"\n" +
|
||||
x.orgChild1.orgChild1Name +
|
||||
"\n" +
|
||||
x.orgRoot.orgRootName,
|
||||
"\n" +
|
||||
x.orgChild3.orgChild3Name +
|
||||
"\n" +
|
||||
x.orgChild2.orgChild2Name +
|
||||
"\n" +
|
||||
x.orgChild1.orgChild1Name +
|
||||
"\n" +
|
||||
x.orgRoot.orgRootName,
|
||||
positionName: x?.current_holder.position ?? _null,
|
||||
profileId: x?.current_holder.id ?? _null,
|
||||
});
|
||||
|
|
@ -3980,8 +3977,8 @@ export class CommandController extends Controller {
|
|||
relations: {
|
||||
roleKeycloaks: true,
|
||||
posType: true,
|
||||
posLevel: true
|
||||
}
|
||||
posLevel: true,
|
||||
},
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
|
@ -4066,7 +4063,7 @@ export class CommandController extends Controller {
|
|||
orgChild2: true,
|
||||
orgChild3: true,
|
||||
orgChild4: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
orgRootRef = curPosMaster?.orgRoot ?? null;
|
||||
orgChild1Ref = curPosMaster?.orgChild1 ?? null;
|
||||
|
|
@ -4258,28 +4255,17 @@ export class CommandController extends Controller {
|
|||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// profile.posLevel?.posLevelName ?? "",
|
||||
// item.commandDateAffect ?? new Date(),
|
||||
// organizeName,
|
||||
// clearProfile.retireTypeName ?? "",
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
profile.posLevel?.posLevelName ?? "",
|
||||
item.commandDateAffect ?? new Date(),
|
||||
organizeName,
|
||||
clearProfile.retireTypeName ?? "",
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
|
@ -4379,8 +4365,8 @@ export class CommandController extends Controller {
|
|||
relations: {
|
||||
roleKeycloaks: true,
|
||||
posType: true,
|
||||
posLevel: true
|
||||
}
|
||||
posLevel: true,
|
||||
},
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -4466,7 +4452,7 @@ export class CommandController extends Controller {
|
|||
orgChild2: true,
|
||||
orgChild3: true,
|
||||
orgChild4: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
orgRootRef = curPosMaster?.orgRoot ?? null;
|
||||
orgChild1Ref = curPosMaster?.orgChild1 ?? null;
|
||||
|
|
@ -4509,28 +4495,17 @@ export class CommandController extends Controller {
|
|||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`,
|
||||
// item.commandDateAffect ?? new Date(),
|
||||
// organizeName,
|
||||
// clearProfile.retireTypeName ?? "",
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
`${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`,
|
||||
item.commandDateAffect ?? new Date(),
|
||||
organizeName,
|
||||
clearProfile.retireTypeName ?? "",
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
|
@ -4633,8 +4608,8 @@ export class CommandController extends Controller {
|
|||
relations: {
|
||||
roleKeycloaks: true,
|
||||
posType: true,
|
||||
posLevel: true
|
||||
}
|
||||
posLevel: true,
|
||||
},
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
|
@ -4783,28 +4758,17 @@ export class CommandController extends Controller {
|
|||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// profile.posLevel?.posLevelName ?? "",
|
||||
// item.commandDateAffect ?? new Date(),
|
||||
// organizeName,
|
||||
// clearProfile.retireTypeName ?? "",
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
profile.posLevel?.posLevelName ?? "",
|
||||
item.commandDateAffect ?? new Date(),
|
||||
organizeName,
|
||||
clearProfile.retireTypeName ?? "",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -5411,29 +5375,19 @@ export class CommandController extends Controller {
|
|||
let _posLevelName: string = !isEmployee
|
||||
? `${profile.posLevel?.posLevelName}`
|
||||
: `${profile.posType?.posTypeName} ${profile.posLevel?.posLevelName}`;
|
||||
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// _posLevelName,
|
||||
// item.commandDateAffect ?? new Date(),
|
||||
// organizeName,
|
||||
// retireTypeName,
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
_posLevelName,
|
||||
item.commandDateAffect ?? new Date(),
|
||||
organizeName,
|
||||
retireTypeName,
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
|
@ -5768,14 +5722,14 @@ export class CommandController extends Controller {
|
|||
) {
|
||||
let _posNumCodeSit: string = "";
|
||||
let _posNumCodeSitAbb: string = "";
|
||||
let commandType: any = ""
|
||||
let commandType: any = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
});
|
||||
if (_command) {
|
||||
commandType = await this.commandTypeRepository.findOne({
|
||||
select: { code: true },
|
||||
where: { id: _command.commandTypeId }
|
||||
where: { id: _command.commandTypeId },
|
||||
});
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
const orgRootDeputy = await this.orgRootRepository.findOne({
|
||||
|
|
@ -5909,10 +5863,7 @@ export class CommandController extends Controller {
|
|||
|
||||
if (commandType && String(commandType.code) == "C-PM-11") {
|
||||
const profileIds = body.data.map((x) => x.profileId);
|
||||
await this.profileRepository.update(
|
||||
{ id: In(profileIds) },
|
||||
{ isProbation: false }
|
||||
);
|
||||
await this.profileRepository.update({ id: In(profileIds) }, { isProbation: false });
|
||||
// // Task #2304 อัปเดตจำนวนสิทธิ์การลา เมื่อผ่านทดลองงานฯ
|
||||
// if (leaveType != null) {
|
||||
// await Promise.all(
|
||||
|
|
@ -6071,26 +6022,26 @@ export class CommandController extends Controller {
|
|||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgChild4 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgChild4 != null
|
||||
? `${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)
|
||||
?.orgChild3 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${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)
|
||||
?.orgChild2 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgChild1 != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
||||
: null;
|
||||
const posNo = `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`;
|
||||
|
|
@ -6187,28 +6138,17 @@ export class CommandController extends Controller {
|
|||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// profile.posLevel?.posLevelName ?? "",
|
||||
// item.commandDateAffect ?? new Date(),
|
||||
// organizeName,
|
||||
// clearProfile.retireTypeName ?? "",
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
item.commandDateAffect?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
profile.posLevel?.posLevelName ?? "",
|
||||
item.commandDateAffect ?? new Date(),
|
||||
organizeName,
|
||||
clearProfile.retireTypeName ?? "",
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
|
@ -6932,8 +6872,8 @@ export class CommandController extends Controller {
|
|||
prefix: avatar,
|
||||
fileName: fileName,
|
||||
})
|
||||
.then(() => { })
|
||||
.catch(() => { });
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
|
@ -7516,7 +7456,7 @@ export class CommandController extends Controller {
|
|||
where: {
|
||||
profileId: item.posMasterChild.current_holderId,
|
||||
status: true,
|
||||
isDeleted: false
|
||||
isDeleted: false,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -8044,7 +7984,7 @@ export class CommandController extends Controller {
|
|||
.then(async (res) => {
|
||||
_command = res;
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
|
||||
let issue =
|
||||
command.isBangkok == "OFFICE"
|
||||
|
|
|
|||
|
|
@ -183,6 +183,12 @@ export async function PostRetireToExprofile(
|
|||
organizeName: string, // child4Name child3Name child2Name child1Name rootName
|
||||
retireTypeName: string, // เช่น เกษียณ, ขอโอนออก, ลาออก, ปลดออก, ไล่ออก, ...
|
||||
) {
|
||||
// check NODE_ENV ถ้าเป็น production ถึงจะทำการส่งข้อมูลไปยัง exprofile
|
||||
const NODE_ENV = process.env.NODE_ENV || "development";
|
||||
if (NODE_ENV !== "production") {
|
||||
return;
|
||||
}
|
||||
|
||||
let retryCount = 0;
|
||||
const maxRetries = 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -322,7 +322,15 @@ export class ProfileController extends Controller {
|
|||
];
|
||||
|
||||
const educations = await this.profileEducationRepo.find({
|
||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
|
||||
select: [
|
||||
"startDate",
|
||||
"endDate",
|
||||
"educationLevel",
|
||||
"degree",
|
||||
"field",
|
||||
"institute",
|
||||
"isDeleted",
|
||||
],
|
||||
where: { profileId: id, isDeleted: false },
|
||||
order: { level: "ASC" },
|
||||
});
|
||||
|
|
@ -655,7 +663,15 @@ export class ProfileController extends Controller {
|
|||
];
|
||||
|
||||
const education_raw = await this.profileEducationRepo.find({
|
||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
|
||||
select: [
|
||||
"startDate",
|
||||
"endDate",
|
||||
"educationLevel",
|
||||
"degree",
|
||||
"field",
|
||||
"institute",
|
||||
"isDeleted",
|
||||
],
|
||||
where: { profileId: id, isDeleted: false },
|
||||
// order: { lastUpdatedAt: "DESC" },
|
||||
order: { level: "ASC" },
|
||||
|
|
@ -1052,7 +1068,14 @@ export class ProfileController extends Controller {
|
|||
let _child4 = child4?.orgChild4Name;
|
||||
|
||||
const cert_raw = await this.certificateRepository.find({
|
||||
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate", "isDeleted"],
|
||||
select: [
|
||||
"certificateType",
|
||||
"issuer",
|
||||
"certificateNo",
|
||||
"issueDate",
|
||||
"expireDate",
|
||||
"isDeleted",
|
||||
],
|
||||
where: { profileId: id, isDeleted: false },
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
|
@ -1069,12 +1092,14 @@ export class ProfileController extends Controller {
|
|||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
|
||||
: "",
|
||||
issueToExpireDate: item.issueDate
|
||||
? item.expireDate
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.issueDate)} - ${Extension.ToThaiFullDate2(item.expireDate)}`)
|
||||
? item.expireDate
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.issueDate)} - ${Extension.ToThaiFullDate2(item.expireDate)}`,
|
||||
)
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate))
|
||||
: item.expireDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
|
||||
: ""
|
||||
: "",
|
||||
}))
|
||||
: [
|
||||
{
|
||||
|
|
@ -1246,7 +1271,7 @@ export class ProfileController extends Controller {
|
|||
"page",
|
||||
"refCommandDate",
|
||||
"note",
|
||||
"isDeleted"
|
||||
"isDeleted",
|
||||
],
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
@ -1325,9 +1350,7 @@ export class ProfileController extends Controller {
|
|||
const totalLeaveDaysKey = `totalLeaveDaysLv${lvIndex}`;
|
||||
const leaveTypeNameKey = `leaveTypeNameLv${lvIndex}`;
|
||||
|
||||
const leaveDate = item.maxDateLeaveStart
|
||||
? new Date(item.maxDateLeaveStart)
|
||||
: null;
|
||||
const leaveDate = item.maxDateLeaveStart ? new Date(item.maxDateLeaveStart) : null;
|
||||
const year = leaveDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(leaveDate))
|
||||
: "";
|
||||
|
|
@ -1525,7 +1548,9 @@ export class ProfileController extends Controller {
|
|||
? actposition_raw.map((item) => ({
|
||||
date:
|
||||
item.dateStart && item.dateEnd
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||
)
|
||||
: item.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||
: item.dateEnd
|
||||
|
|
@ -1550,7 +1575,9 @@ export class ProfileController extends Controller {
|
|||
? assistance_raw.map((item) => ({
|
||||
date:
|
||||
item.dateStart && item.dateEnd
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||
)
|
||||
: item.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||
: item.dateEnd
|
||||
|
|
@ -1580,7 +1607,9 @@ export class ProfileController extends Controller {
|
|||
? duty_raw.map((item) => ({
|
||||
date:
|
||||
item.dateStart && item.dateEnd
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||
)
|
||||
: item.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||
: item.dateEnd
|
||||
|
|
@ -1858,7 +1887,7 @@ export class ProfileController extends Controller {
|
|||
? Extension.ToThaiNumber(profiles.registrationZipCode)
|
||||
: "",
|
||||
fullRegistrationAddress: fullRegistrationAddress,
|
||||
updateAt: profiles.lastUpdatedAt
|
||||
updateAt: profiles.lastUpdatedAt
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.lastUpdatedAt))
|
||||
: "",
|
||||
telephone: profiles.phone != null ? Extension.ToThaiNumber(profiles.phone) : "",
|
||||
|
|
@ -2267,8 +2296,8 @@ export class ProfileController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -6244,8 +6273,8 @@ export class ProfileController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{ child1: _data.child1 },
|
||||
)
|
||||
|
|
@ -6632,8 +6661,8 @@ export class ProfileController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{ child1: _data.child1 },
|
||||
)
|
||||
|
|
@ -7718,7 +7747,7 @@ export class ProfileController extends Controller {
|
|||
child2Id: null,
|
||||
child3Id: null,
|
||||
child4Id: null,
|
||||
rootDnaId: null
|
||||
rootDnaId: null,
|
||||
});
|
||||
}
|
||||
return new HttpSuccess({
|
||||
|
|
@ -7728,7 +7757,7 @@ export class ProfileController extends Controller {
|
|||
child2Id: posMasters?.orgChild2Id || null,
|
||||
child3Id: posMasters?.orgChild3Id || null,
|
||||
child4Id: posMasters?.orgChild4Id || null,
|
||||
rootDnaId: posMasters?.orgRoot?.ancestorDNA || null
|
||||
rootDnaId: posMasters?.orgRoot?.ancestorDNA || null,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -8987,8 +9016,8 @@ export class ProfileController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{ child1: _data.child1 },
|
||||
)
|
||||
|
|
@ -9511,8 +9540,8 @@ export class ProfileController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -10922,28 +10951,17 @@ export class ProfileController extends Controller {
|
|||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// requestBody.dateLeave?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// profile.posLevel?.posLevelName ?? "",
|
||||
// requestBody.dateLeave ?? new Date(),
|
||||
// organizeName,
|
||||
// "ถึงแก่กรรม",
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
requestBody.dateLeave?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
profile.posLevel?.posLevelName ?? "",
|
||||
requestBody.dateLeave ?? new Date(),
|
||||
organizeName,
|
||||
"ถึงแก่กรรม",
|
||||
);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,15 @@ export class ProfileEmployeeController extends Controller {
|
|||
];
|
||||
|
||||
const educations = await this.profileEducationRepo.find({
|
||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
|
||||
select: [
|
||||
"startDate",
|
||||
"endDate",
|
||||
"educationLevel",
|
||||
"degree",
|
||||
"field",
|
||||
"institute",
|
||||
"isDeleted",
|
||||
],
|
||||
where: { profileEmployeeId: id, isDeleted: false },
|
||||
order: { level: "ASC" },
|
||||
});
|
||||
|
|
@ -651,7 +659,15 @@ export class ProfileEmployeeController extends Controller {
|
|||
];
|
||||
|
||||
const education_raw = await this.profileEducationRepo.find({
|
||||
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
|
||||
select: [
|
||||
"startDate",
|
||||
"endDate",
|
||||
"educationLevel",
|
||||
"degree",
|
||||
"field",
|
||||
"institute",
|
||||
"isDeleted",
|
||||
],
|
||||
where: { profileEmployeeId: id, isDeleted: false },
|
||||
// order: { lastUpdatedAt: "DESC" },
|
||||
order: { level: "ASC" },
|
||||
|
|
@ -1048,7 +1064,14 @@ export class ProfileEmployeeController extends Controller {
|
|||
let _child4 = child4?.orgChild4Name;
|
||||
|
||||
const cert_raw = await this.certificateRepository.find({
|
||||
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate", "isDeleted"],
|
||||
select: [
|
||||
"certificateType",
|
||||
"issuer",
|
||||
"certificateNo",
|
||||
"issueDate",
|
||||
"expireDate",
|
||||
"isDeleted",
|
||||
],
|
||||
where: { profileEmployeeId: id, isDeleted: false },
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
|
@ -1065,12 +1088,14 @@ export class ProfileEmployeeController extends Controller {
|
|||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
|
||||
: "",
|
||||
issueToExpireDate: item.issueDate
|
||||
? item.expireDate
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.issueDate)} - ${Extension.ToThaiFullDate2(item.expireDate)}`)
|
||||
? item.expireDate
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.issueDate)} - ${Extension.ToThaiFullDate2(item.expireDate)}`,
|
||||
)
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate))
|
||||
: item.expireDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
|
||||
: ""
|
||||
: "",
|
||||
}))
|
||||
: [
|
||||
{
|
||||
|
|
@ -1242,7 +1267,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
"page",
|
||||
"refCommandDate",
|
||||
"note",
|
||||
"isDeleted"
|
||||
"isDeleted",
|
||||
],
|
||||
relations: {
|
||||
insignia: {
|
||||
|
|
@ -1321,9 +1346,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
const totalLeaveDaysKey = `totalLeaveDaysLv${lvIndex}`;
|
||||
const leaveTypeNameKey = `leaveTypeNameLv${lvIndex}`;
|
||||
|
||||
const leaveDate = item.maxDateLeaveStart
|
||||
? new Date(item.maxDateLeaveStart)
|
||||
: null;
|
||||
const leaveDate = item.maxDateLeaveStart ? new Date(item.maxDateLeaveStart) : null;
|
||||
const year = leaveDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(leaveDate))
|
||||
: "";
|
||||
|
|
@ -1521,7 +1544,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
? actposition_raw.map((item) => ({
|
||||
date:
|
||||
item.dateStart && item.dateEnd
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||
)
|
||||
: item.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||
: item.dateEnd
|
||||
|
|
@ -1546,7 +1571,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
? assistance_raw.map((item) => ({
|
||||
date:
|
||||
item.dateStart && item.dateEnd
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||
)
|
||||
: item.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||
: item.dateEnd
|
||||
|
|
@ -1576,7 +1603,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
? duty_raw.map((item) => ({
|
||||
date:
|
||||
item.dateStart && item.dateEnd
|
||||
? Extension.ToThaiNumber(`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`)
|
||||
? Extension.ToThaiNumber(
|
||||
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
|
||||
)
|
||||
: item.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
|
||||
: item.dateEnd
|
||||
|
|
@ -1836,7 +1865,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
? Extension.ToThaiNumber(profiles.registrationZipCode)
|
||||
: "",
|
||||
fullRegistrationAddress: fullRegistrationAddress,
|
||||
updateAt: profiles.lastUpdatedAt
|
||||
updateAt: profiles.lastUpdatedAt
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.lastUpdatedAt))
|
||||
: "",
|
||||
telephone: profiles.phone != null ? Extension.ToThaiNumber(profiles.phone) : "",
|
||||
|
|
@ -2888,8 +2917,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -3768,8 +3797,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{ child1: _data.child1 },
|
||||
)
|
||||
|
|
@ -4327,8 +4356,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -5396,28 +5425,17 @@ export class ProfileEmployeeController extends Controller {
|
|||
organizeName = names.join(" ");
|
||||
}
|
||||
await PostRetireToExprofile(
|
||||
// profile.citizenId ?? "",
|
||||
// profile.prefix ?? "",
|
||||
// profile.firstName ?? "",
|
||||
// profile.lastName ?? "",
|
||||
// requestBody.dateLeave?.getFullYear().toString() ?? "",
|
||||
// profile.position,
|
||||
// profile.posType?.posTypeName ?? "",
|
||||
// `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`,
|
||||
// requestBody.dateLeave ?? new Date(),
|
||||
// organizeName,
|
||||
// "ถึงแก่กรรม",
|
||||
"310190004095X",
|
||||
"จ.ส.อ.",
|
||||
"dev",
|
||||
"hrms",
|
||||
"2026",
|
||||
"เจ้าหน้าที่จัดเก็บรายได้",
|
||||
"อื่นๆ",
|
||||
"C 3",
|
||||
new Date(2026, 0, 1),
|
||||
"สำนักงานเขตบางกอกใหญ่",
|
||||
"เกษียณ"
|
||||
profile.citizenId ?? "",
|
||||
profile.prefix ?? "",
|
||||
profile.firstName ?? "",
|
||||
profile.lastName ?? "",
|
||||
requestBody.dateLeave?.getFullYear().toString() ?? "",
|
||||
profile.position,
|
||||
profile.posType?.posTypeName ?? "",
|
||||
`${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`,
|
||||
requestBody.dateLeave ?? new Date(),
|
||||
organizeName,
|
||||
"ถึงแก่กรรม",
|
||||
);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue