no message

This commit is contained in:
kittapath 2025-03-06 16:31:10 +07:00
parent 6638ec29c0
commit 54fed22902

View file

@ -86,7 +86,9 @@ export class ProfileSalaryController extends Controller {
await this.positionEmployeeRepo.clear(); await this.positionEmployeeRepo.clear();
const profile = await this.profileEmployeeRepo.find(); const profile = await this.profileEmployeeRepo.find();
for await (const x of profile) { for await (const x of profile) {
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [x.id]); const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [
x.id,
]);
const _position = position.length > 0 ? position[0] : []; const _position = position.length > 0 ? position[0] : [];
const mapPosition = const mapPosition =
_position.length > 1 _position.length > 1
@ -174,9 +176,11 @@ export class ProfileSalaryController extends Controller {
public async cronjobTenureLevelEmployee() { public async cronjobTenureLevelEmployee() {
let data: any = []; let data: any = [];
await this.levelEmployeeRepo.clear(); await this.levelEmployeeRepo.clear();
const profile = await this.profileEmployeeRepo.find({ relations: ["posLevel"] }); const profile = await this.profileEmployeeRepo.find({ relations: ["posLevel", "posType"] });
for await (const x of profile) { for await (const x of profile) {
const positionLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [x.id]); const positionLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [
x.id,
]);
const _positionLevel = positionLevel.length > 0 ? positionLevel[0] : []; const _positionLevel = positionLevel.length > 0 ? positionLevel[0] : [];
const mapPositionLevel = const mapPositionLevel =
_positionLevel.length > 1 _positionLevel.length > 1
@ -188,7 +192,11 @@ export class ProfileSalaryController extends Controller {
})) }))
: []; : [];
const calDayDiff = mapPositionLevel const calDayDiff = mapPositionLevel
.filter((curr: any) => curr.positionLevel == (x.posLevel?.posLevelName ?? null)) .filter(
(curr: any) =>
curr.positionLevel == (x.posLevel?.posLevelName ?? null) &&
curr.positionType == (x.posType?.posTypeName ?? null),
)
.reduce( .reduce(
(acc: any, curr: any) => { (acc: any, curr: any) => {
acc.days_diff += Number(curr.days_diff) || 0; acc.days_diff += Number(curr.days_diff) || 0;