เพิ่มเวลาลูกจ้าง
This commit is contained in:
parent
b1c365a4da
commit
2c1e1dd8ff
9 changed files with 390 additions and 244 deletions
|
|
@ -102,14 +102,14 @@ export class OrganizationDotnetController extends Controller {
|
|||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("profile.profileSalary", "profileSalary")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.orderBy("profileSalarys.order", "DESC");
|
||||
.orderBy("profileSalary.order", "DESC");
|
||||
|
||||
if (body.citizenId || body.firstName || body.lastName) {
|
||||
queryBuilder.where(
|
||||
|
|
@ -285,7 +285,76 @@ export class OrganizationDotnetController extends Controller {
|
|||
},
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
if (!profile) {
|
||||
const profile = await this.profileEmpRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { keycloak: keycloakId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const mapProfile = {
|
||||
id: profile.id,
|
||||
avatar: profile.avatar,
|
||||
avatarName: profile.avatarName,
|
||||
rank: profile.rank,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
position: profile.position,
|
||||
posLevelId: profile.posLevelId,
|
||||
email: profile.email,
|
||||
phone: profile.phone,
|
||||
keycloak: profile.keycloak,
|
||||
isProbation: profile.isProbation,
|
||||
isLeave: profile.isLeave,
|
||||
leaveReason: profile.leaveReason,
|
||||
dateRetire: profile.dateRetire,
|
||||
dateAppoint: profile.dateAppoint,
|
||||
dateRetireLaw: profile.dateRetireLaw,
|
||||
dateStart: profile.dateStart,
|
||||
govAgeAbsent: profile.govAgeAbsent,
|
||||
govAgePlus: profile.govAgePlus,
|
||||
birthDate: profile.birthDate,
|
||||
reasonSameDate: profile.reasonSameDate,
|
||||
telephoneNumber: profile.telephoneNumber,
|
||||
nationality: profile.nationality,
|
||||
gender: profile.gender,
|
||||
relationship: profile.relationship,
|
||||
religion: profile.religion,
|
||||
bloodGroup: profile.bloodGroup,
|
||||
registrationAddress: profile.registrationAddress,
|
||||
registrationProvinceId: profile.registrationProvinceId,
|
||||
registrationDistrictId: profile.registrationDistrictId,
|
||||
registrationSubDistrictId: profile.registrationSubDistrictId,
|
||||
registrationZipCode: profile.registrationZipCode,
|
||||
currentAddress: profile.currentAddress,
|
||||
currentProvinceId: profile.currentProvinceId,
|
||||
currentSubDistrictId: profile.currentSubDistrictId,
|
||||
currentZipCode: profile.currentZipCode,
|
||||
dutyTimeId: profile.dutyTimeId,
|
||||
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel ? profile.posLevel : null,
|
||||
posType: profile.posType ? profile.posType : null,
|
||||
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
|
||||
profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null,
|
||||
};
|
||||
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
|
||||
const mapProfile = {
|
||||
id: profile.id,
|
||||
|
|
@ -446,12 +515,12 @@ export class OrganizationDotnetController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalarys: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { citizenId: citizenId },
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
|
|
@ -505,7 +574,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
dutyTimeEffectiveDate: null,
|
||||
posLevel: _profile.posLevel ? _profile.posLevel : null,
|
||||
posType: _profile.posType ? _profile.posType : null,
|
||||
profileSalary: _profile.profileSalarys,
|
||||
profileSalary: _profile.profileSalary,
|
||||
profileInsignia: _profile.profileInsignias,
|
||||
profileType: "EMPLOYEE",
|
||||
};
|
||||
|
|
@ -656,12 +725,12 @@ export class OrganizationDotnetController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalarys: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
|
|
@ -715,7 +784,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel ? profile.posLevel : null,
|
||||
posType: profile.posType ? profile.posType : null,
|
||||
profileSalary: profile.profileSalarys,
|
||||
profileSalary: profile.profileSalary,
|
||||
profileInsignia: profile.profileInsignias,
|
||||
}));
|
||||
|
||||
|
|
@ -1103,7 +1172,20 @@ export class OrganizationDotnetController extends Controller {
|
|||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: body.profileId },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
if (!profile) {
|
||||
const profile = await this.profileEmpRepo.findOne({
|
||||
where: { id: body.profileId },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
Object.assign(profile, body);
|
||||
profile.dutyTimeId = body.roundId;
|
||||
profile.dutyTimeEffectiveDate = body.effectiveDate;
|
||||
profile.lastUpdateUserId = req.user.sub;
|
||||
profile.lastUpdateFullName = req.user.name;
|
||||
profile.lastUpdatedAt = new Date();
|
||||
await this.profileEmpRepo.save(profile);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
Object.assign(profile, body);
|
||||
profile.dutyTimeId = body.roundId;
|
||||
profile.dutyTimeEffectiveDate = body.effectiveDate;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue