no message

This commit is contained in:
Bright 2025-02-27 18:24:11 +07:00
parent 5287e4f286
commit 84af3c725e
4 changed files with 314 additions and 1 deletions

View file

@ -87,6 +87,37 @@ export class ProfileSalaryEmployeeController extends Controller {
return new HttpSuccess(record);
}
@Get("tenure/{profileId}")
public async getPositionTenure(@Path() profileId: string, @Request() req: RequestWithUser) {
const position = await AppDataSource.query(
"CALL GetProfileEmployeeSalaryPosition(?)",
[profileId]
);
const _position = position.length > 0 ? position[0] : []
const mapPosition = _position.length > 1
? _position
.slice(1)
.map((curr: any, index: number) => ({
year: curr.Years ? Math.floor(Number(curr.Years)) : 0,
month: curr.Months ? Math.floor(Number(curr.Months)) : 0,
day: curr.Days ? Math.floor(Number(curr.Days)) : 0,
name: _position[index]?.positionName
}))
: [];
const posLevel = [{
year: 3,
month: 0,
day: 0,
name: "ส 1",
}];
return new HttpSuccess({
position: mapPosition,
posLevel: posLevel
});
}
@Get("admin/{profileId}")
public async getSalaryEmployeeAdmin(@Path() profileId: string, @Request() req: RequestWithUser) {
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");

View file

@ -189,6 +189,9 @@ export class ReportController extends Controller {
@Query() isRetire?: boolean,
@Query() isRetireLaw?: boolean,
@Query() retireType?: string,
@Query() tenureType?: string,
@Query() tenureMin?: number,
@Query() tenureMax?: number,
@Query() sortBy: string = "posMasterNo",
@Query() sort: "ASC" | "DESC" = "ASC",
) {
@ -211,6 +214,9 @@ export class ReportController extends Controller {
ageMin = ageMin ?? 18;
ageMax = ageMax ?? 60;
tenureMin = tenureMin ?? 0;
tenureMax = tenureMax ?? 20;
let nodeCondition = "1=1";
if (node === 0 && nodeId) {
nodeCondition = "registryOfficer.orgRootId = :nodeId";
@ -246,11 +252,23 @@ export class ReportController extends Controller {
"DATE(registryOfficer.dateRetireLaw) >= :startDateRetireLaw AND DATE(registryOfficer.dateRetireLaw) <= :endDateRetireLaw";
}
let tenureTypeCondition = "1=1";
if(tenureType != "" && tenureType == "position") {
tenureTypeCondition = "registryOfficer.Years BETWEEN :tenureMin AND :tenureMax";
}
else if (tenureType != "" && tenureType == "level") {
tenureTypeCondition = "registryOfficer.posxecutiveYears BETWEEN :tenureMin AND :tenureMax";
}
const [lists, total] = await AppDataSource.getRepository(viewRegistryOfficer)
.createQueryBuilder("registryOfficer")
.where(nodeCondition, {
nodeId: nodeId,
})
.andWhere(tenureTypeCondition, {
tenureMin: tenureMin,
tenureMax: tenureMax,
})
.andWhere("registryOfficer.age BETWEEN :ageMin AND :ageMax", {
ageMin,
ageMax,
@ -325,6 +343,7 @@ export class ReportController extends Controller {
)
.orderBy(`registryOfficer.${sortBy}`, sort)
.getManyAndCount();
const mapData = lists.map((x) => ({
profileId: x.profileId,
citizenId: x.citizenId,
@ -362,6 +381,12 @@ export class ReportController extends Controller {
age: x.age,
currentPosition: null,
lengthPosition: null,
Years: x.Years,
Months: x.Months,
Days: x.Days,
// posExecutiveYears: x.posExecutiveYears,
// posExecutiveMonths: x.posExecutiveMonths,
// posExecutiveDays: x.posExecutiveDays
}));
return new HttpSuccess({
data: mapData,
@ -504,6 +529,9 @@ export class ReportController extends Controller {
@Query() retireType?: string,
@Query() ageMin?: number,
@Query() ageMax?: number,
@Query() tenureType?: string,
@Query() tenureMin?: number,
@Query() tenureMax?: number,
@Query() sortBy: string = "posMasterNo",
@Query() sort: "ASC" | "DESC" = "ASC",
) {
@ -526,6 +554,9 @@ export class ReportController extends Controller {
ageMin = ageMin ?? 18;
ageMax = ageMax ?? 60;
tenureMin = tenureMin ?? 0;
tenureMax = tenureMax ?? 20;
let nodeCondition = "1=1";
if (node === 0 && nodeId) {
nodeCondition = "registryEmployee.orgRootId = :nodeId";