ออกคำสั่งลูกจ้างชั่วคราว
This commit is contained in:
parent
576f83d12f
commit
f1cdec9076
1 changed files with 49 additions and 25 deletions
|
|
@ -18,7 +18,7 @@ import { AppDataSource } from "../database/data-source";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { Brackets, IsNull, Like, Not } from "typeorm";
|
import { Brackets, In, IsNull, Like, Not } from "typeorm";
|
||||||
import { OrgRevision } from "../entities/OrgRevision";
|
import { OrgRevision } from "../entities/OrgRevision";
|
||||||
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
|
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
|
||||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||||
|
|
@ -560,7 +560,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
id: Not(id),
|
id: Not(id),
|
||||||
citizenId: body.citizenId,
|
citizenId: body.citizenId,
|
||||||
employeeClass: String(body.employeeClass)
|
employeeClass: String(body.employeeClass),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -694,8 +694,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
_data.profileEmployeeEmployment.length == 0
|
_data.profileEmployeeEmployment.length == 0
|
||||||
? null
|
? null
|
||||||
: _data.profileEmployeeEmployment.reduce((latest, current) => {
|
: _data.profileEmployeeEmployment.reduce((latest, current) => {
|
||||||
return (latest.date > current.date) ? latest : current;
|
return latest.date > current.date ? latest : current;
|
||||||
}).date;
|
}).date;
|
||||||
return {
|
return {
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
prefix: _data.prefix,
|
prefix: _data.prefix,
|
||||||
|
|
@ -937,8 +937,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
_data.profileEmployeeEmployment.length == 0
|
_data.profileEmployeeEmployment.length == 0
|
||||||
? null
|
? null
|
||||||
: _data.profileEmployeeEmployment.reduce((latest, current) => {
|
: _data.profileEmployeeEmployment.reduce((latest, current) => {
|
||||||
return (latest.date > current.date) ? latest : current;
|
return latest.date > current.date ? latest : current;
|
||||||
}).date;
|
}).date;
|
||||||
return {
|
return {
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
prefix: _data.prefix,
|
prefix: _data.prefix,
|
||||||
|
|
@ -2576,22 +2576,22 @@ export class ProfileEmployeeController extends Controller {
|
||||||
@Get("information/{profileEmployeeId}")
|
@Get("information/{profileEmployeeId}")
|
||||||
async getInformationById(@Path() profileEmployeeId: string) {
|
async getInformationById(@Path() profileEmployeeId: string) {
|
||||||
const profileInformation = await this.profileRepo.findOne({
|
const profileInformation = await this.profileRepo.findOne({
|
||||||
where: { id: profileEmployeeId }
|
where: { id: profileEmployeeId },
|
||||||
});
|
});
|
||||||
if (!profileInformation) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profileInformation) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const mapData = {
|
const mapData = {
|
||||||
id: profileInformation.id,
|
id: profileInformation.id,
|
||||||
positionEmployeeGroupId: profileInformation.positionEmployeeGroupId,
|
positionEmployeeGroupId: profileInformation.positionEmployeeGroupId,
|
||||||
positionEmployeeLineId: profileInformation.positionEmployeeLineId,
|
positionEmployeeLineId: profileInformation.positionEmployeeLineId,
|
||||||
positionEmployeePositionId: profileInformation.positionEmployeePositionId,
|
positionEmployeePositionId: profileInformation.positionEmployeePositionId,
|
||||||
employeeOc: profileInformation.employeeOc,
|
employeeOc: profileInformation.employeeOc,
|
||||||
employeeTypeIndividual: profileInformation.employeeTypeIndividual,
|
employeeTypeIndividual: profileInformation.employeeTypeIndividual,
|
||||||
employeeWage: profileInformation.employeeWage,
|
employeeWage: profileInformation.employeeWage,
|
||||||
employeeMoneyIncrease: profileInformation.employeeMoneyIncrease,
|
employeeMoneyIncrease: profileInformation.employeeMoneyIncrease,
|
||||||
employeeMoneyAllowance: profileInformation.employeeMoneyAllowance,
|
employeeMoneyAllowance: profileInformation.employeeMoneyAllowance,
|
||||||
employeeMoneyEmployee: profileInformation.employeeMoneyEmployee,
|
employeeMoneyEmployee: profileInformation.employeeMoneyEmployee,
|
||||||
employeeMoneyEmployer: profileInformation.employeeMoneyEmployer,
|
employeeMoneyEmployer: profileInformation.employeeMoneyEmployer,
|
||||||
};
|
};
|
||||||
return new HttpSuccess(mapData);
|
return new HttpSuccess(mapData);
|
||||||
}
|
}
|
||||||
|
|
@ -2781,4 +2781,28 @@ export class ProfileEmployeeController extends Controller {
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่งลูกจ้าง
|
||||||
|
*
|
||||||
|
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("report")
|
||||||
|
async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) {
|
||||||
|
const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } });
|
||||||
|
|
||||||
|
const _profiles = await Promise.all(
|
||||||
|
profiles.map(async (item: any) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
statusTemp: "REPORT",
|
||||||
|
lastUpdateUserId: request.user.sub,
|
||||||
|
lastUpdateFullName: request.user.name,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await this.profileRepo.save(_profiles);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue