Merge branch 'develop' into adiDev
This commit is contained in:
commit
ea2566395e
13 changed files with 341 additions and 55 deletions
|
|
@ -27,11 +27,25 @@ export class AuthSysController extends Controller {
|
||||||
|
|
||||||
@Get("list")
|
@Get("list")
|
||||||
public async listAuthSys() {
|
public async listAuthSys() {
|
||||||
const getList = await this.authSysRepo.find();
|
const getList = await this.authSysRepo.find({
|
||||||
// if (!getList || getList.length === 0) {
|
select: ["id", "parentId", "sysName", "sysDescription", "order"],
|
||||||
// throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
});
|
||||||
// }
|
|
||||||
return new HttpSuccess(getList);
|
if (!getList || getList.length === 0) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
}
|
||||||
|
|
||||||
|
const lists = getList
|
||||||
|
.filter((x) => x.parentId == null)
|
||||||
|
.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
children: getList.filter((x) => x.parentId == item.id).sort((a, b) => a.order - b.order),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => a.order - b.order);
|
||||||
|
|
||||||
|
return new HttpSuccess(lists);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("{systemId}")
|
@Get("{systemId}")
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import HttpError from "../interfaces/http-error";
|
||||||
import { Equal, ILike, In, IsNull, Like, Not, Brackets, MoreThan } from "typeorm";
|
import { Equal, ILike, In, IsNull, Like, Not, Brackets, MoreThan } from "typeorm";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import { ChangePosition, CreateChangePosition, UpdateChangePosition } from "../entities/ChangePosition";
|
import { ChangePosition, CreateChangePosition, UpdateChangePosition } from "../entities/ChangePosition";
|
||||||
|
import { ProfileChangePosition, CreateProfileChangePosition } from "../entities/ProfileChangePosition";
|
||||||
|
|
||||||
@Route("api/v1/org/placement/change-position")
|
@Route("api/v1/org/placement/change-position")
|
||||||
@Tags("Placement")
|
@Tags("Placement")
|
||||||
|
|
@ -33,7 +34,8 @@ import { ChangePosition, CreateChangePosition, UpdateChangePosition } from "../e
|
||||||
)
|
)
|
||||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||||
export class ChangePositionController extends Controller {
|
export class ChangePositionController extends Controller {
|
||||||
private ChangePositionRepository = AppDataSource.getRepository(ChangePosition);
|
private ChangePositionRepository = AppDataSource.getRepository(ChangePosition);
|
||||||
|
private ProfileChangePositionRepository = AppDataSource.getRepository(ProfileChangePosition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API เพิ่มรอบย้ายสับเปลี่ยนตำแหน่ง
|
* API เพิ่มรอบย้ายสับเปลี่ยนตำแหน่ง
|
||||||
|
|
@ -68,6 +70,41 @@ export class ChangePositionController extends Controller {
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API เพิ่มเพิ่มรายชื่อผู้ที่ย้ายสับเปลี่ยนตำแหน่ง
|
||||||
|
*
|
||||||
|
* @summary เพิ่มเพิ่มรายชื่อผู้ที่ย้ายสับเปลี่ยนตำแหน่ง (ADMIN)
|
||||||
|
*
|
||||||
|
* @param {string} id Id รอบย้ายสับเปลี่ยนตำแหน่ง
|
||||||
|
*/
|
||||||
|
@Post("profile/{id}")
|
||||||
|
async CreateProfileChangePosition(
|
||||||
|
@Path() id: string,
|
||||||
|
@Body() body: CreateProfileChangePosition,
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
const changePosition = await this.ChangePositionRepository.findOneBy({ id });
|
||||||
|
if (!changePosition) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบย้ายสับเปลี่ยนตำแหน่ง");
|
||||||
|
|
||||||
|
const profileChangePositions: ProfileChangePosition[] = [];
|
||||||
|
const profiles = new ProfileChangePosition();
|
||||||
|
for (const data of body.profiles) {
|
||||||
|
Object.assign(profiles, data);
|
||||||
|
let positionOld = data.positionOld ? `${data.positionOld}` : "";
|
||||||
|
let rootOld = data.rootOld ? data.positionOld ? `/${data.rootOld}` : `${data.rootOld}` : "";
|
||||||
|
profiles.changePositionId = id;
|
||||||
|
profiles.organizationPositionOld = `${positionOld}${rootOld}`,
|
||||||
|
profiles.status = "WAITTING",
|
||||||
|
profiles.createdUserId = request.user.sub;
|
||||||
|
profiles.createdFullName = request.user.name;
|
||||||
|
profiles.lastUpdateUserId = request.user.sub;
|
||||||
|
profiles.lastUpdateFullName = request.user.name;
|
||||||
|
profileChangePositions.push(profiles);
|
||||||
|
}
|
||||||
|
await this.ProfileChangePositionRepository.save(profileChangePositions);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ลบรอบย้ายสับเปลี่ยนตำแหน่ง
|
* API ลบรอบย้ายสับเปลี่ยนตำแหน่ง
|
||||||
*
|
*
|
||||||
|
|
@ -107,7 +144,7 @@ export class ChangePositionController extends Controller {
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const changePosition = await this.ChangePositionRepository.findOneBy({ id });
|
const changePosition = await this.ChangePositionRepository.findOneBy({ id });
|
||||||
if (!changePosition) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!changePosition) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบย้ายสับเปลี่ยนตำแหน่ง");
|
||||||
|
|
||||||
const checkDuplicate = await this.ChangePositionRepository.find({
|
const checkDuplicate = await this.ChangePositionRepository.find({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -134,7 +171,7 @@ export class ChangePositionController extends Controller {
|
||||||
* @summary API รายการรอบย้ายสับเปลี่ยนตำแหน่ง (ADMIN)
|
* @summary API รายการรอบย้ายสับเปลี่ยนตำแหน่ง (ADMIN)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Get("")
|
@Get()
|
||||||
async GetChangePositionLists() {
|
async GetChangePositionLists() {
|
||||||
const data = await this.ChangePositionRepository.find();
|
const data = await this.ChangePositionRepository.find();
|
||||||
return new HttpSuccess(data);
|
return new HttpSuccess(data);
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,8 @@ export class EmployeePositionController extends Controller {
|
||||||
? null
|
? null
|
||||||
: `${position.posType.posTypeShortName} ${position.posLevel.posLevelName}`,
|
: `${position.posType.posTypeShortName} ${position.posLevel.posLevelName}`,
|
||||||
positionIsSelected: position.positionIsSelected,
|
positionIsSelected: position.positionIsSelected,
|
||||||
|
isOfficer: posMaster.isOfficer,
|
||||||
|
isDirecter: posMaster.isDirector,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
|
|
@ -611,6 +613,8 @@ export class EmployeePositionController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
||||||
}
|
}
|
||||||
posMaster.posMasterNo = requestBody.posMasterNo;
|
posMaster.posMasterNo = requestBody.posMasterNo;
|
||||||
|
posMaster.isDirector = requestBody.isDirector;
|
||||||
|
posMaster.isOfficer = requestBody.isOfficer;
|
||||||
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
||||||
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
||||||
posMaster.reason = requestBody.reason == null ? "" : requestBody.reason;
|
posMaster.reason = requestBody.reason == null ? "" : requestBody.reason;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ import { ProfileFamilyCouple } from "../entities/ProfileFamilyCouple";
|
||||||
import { ProfileFamilyMother } from "../entities/ProfileFamilyMother";
|
import { ProfileFamilyMother } from "../entities/ProfileFamilyMother";
|
||||||
import { ProfileFamilyFather } from "../entities/ProfileFamilyFather";
|
import { ProfileFamilyFather } from "../entities/ProfileFamilyFather";
|
||||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
|
import { PosType } from "../entities/PosType";
|
||||||
|
|
||||||
@Route("api/v1/org/upload")
|
@Route("api/v1/org/upload")
|
||||||
@Tags("UPLOAD")
|
@Tags("UPLOAD")
|
||||||
|
|
@ -40,6 +42,8 @@ export class ImportDataController extends Controller {
|
||||||
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
|
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
|
||||||
private profileRepo = AppDataSource.getRepository(Profile);
|
private profileRepo = AppDataSource.getRepository(Profile);
|
||||||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||||
|
private posLevelRepo = AppDataSource.getRepository(PosLevel);
|
||||||
|
private posTypeRepo = AppDataSource.getRepository(PosType);
|
||||||
/**
|
/**
|
||||||
* API upload EDU
|
* API upload EDU
|
||||||
*
|
*
|
||||||
|
|
@ -594,4 +598,58 @@ export class ImportDataController extends Controller {
|
||||||
await this.salaryRepository.save(profiles);
|
await this.salaryRepository.save(profiles);
|
||||||
return new HttpSuccess(allData);
|
return new HttpSuccess(allData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post("uploadposSQL")
|
||||||
|
@UseInterceptors(FileInterceptor("file"))
|
||||||
|
async UploadPOSFileSQL(@UploadedFile() file: Express.Multer.File) {
|
||||||
|
const workbook = xlsx.read(file.buffer, { type: "buffer" });
|
||||||
|
const sheetName = workbook.SheetNames[0];
|
||||||
|
const sheet = workbook.Sheets[sheetName];
|
||||||
|
const getProFile = xlsx.utils.sheet_to_json(sheet);
|
||||||
|
let profiles: any = [];
|
||||||
|
await Promise.all(
|
||||||
|
getProFile.map(async (item: any) => {
|
||||||
|
// Find profile by ID
|
||||||
|
let profile = await this.profileRepo.findOne({
|
||||||
|
where: { citizenId: item["ID"] },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
return; // Skip processing this item
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item["MP_CEE_TYPE"] === "NULL") {
|
||||||
|
profile.posTypeId = null;
|
||||||
|
} else {
|
||||||
|
// Find posType by posTypeName
|
||||||
|
const posType = await this.posTypeRepo.findOne({
|
||||||
|
where: { posTypeName: item["MP_CEE_TYPE"] },
|
||||||
|
});
|
||||||
|
if (!posType) {
|
||||||
|
return; // Skip processing this item
|
||||||
|
}
|
||||||
|
profile.posTypeId = posType.id;
|
||||||
|
}
|
||||||
|
// Check if posLevelName is "NULL"
|
||||||
|
if (item["MP_CEE_POSITION"] === "NULL") {
|
||||||
|
profile.posLevelId = null;
|
||||||
|
} else {
|
||||||
|
// Find posLevel by posLevelName
|
||||||
|
const posLevel = await this.posLevelRepo.findOne({
|
||||||
|
where: { posLevelName: item["MP_CEE_POSITION"] },
|
||||||
|
});
|
||||||
|
if (!posLevel) {
|
||||||
|
console.error(
|
||||||
|
`posLevel with name ${item["MP_CEE_POSITION"]} not found for profile ID ${profile.id}`,
|
||||||
|
);
|
||||||
|
return; // Skip processing this item
|
||||||
|
}
|
||||||
|
profile.posLevelId = posLevel.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
profiles.push(profile);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await this.profileRepo.save(profiles);
|
||||||
|
return new HttpSuccess(getProFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -797,6 +797,8 @@ export class PositionController extends Controller {
|
||||||
if (!posMaster) {
|
if (!posMaster) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
||||||
}
|
}
|
||||||
|
posMaster.isDirector = requestBody.isDirector;
|
||||||
|
posMaster.isOfficer = requestBody.isOfficer;
|
||||||
posMaster.posMasterNo = requestBody.posMasterNo;
|
posMaster.posMasterNo = requestBody.posMasterNo;
|
||||||
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
||||||
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
||||||
|
|
@ -949,6 +951,8 @@ export class PositionController extends Controller {
|
||||||
position.positionExecutiveField = x.posDictExecutiveField;
|
position.positionExecutiveField = x.posDictExecutiveField;
|
||||||
position.positionArea = x.posDictArea;
|
position.positionArea = x.posDictArea;
|
||||||
position.isSpecial = x.isSpecial;
|
position.isSpecial = x.isSpecial;
|
||||||
|
position.isOfficer = x.isOfficer;
|
||||||
|
position.isDirector = x.isDirector;
|
||||||
position.positionIsSelected = x.positionIsSelected;
|
position.positionIsSelected = x.positionIsSelected;
|
||||||
position.posMasterId = posMaster.id;
|
position.posMasterId = posMaster.id;
|
||||||
position.createdUserId = request.user.sub;
|
position.createdUserId = request.user.sub;
|
||||||
|
|
@ -1001,6 +1005,8 @@ export class PositionController extends Controller {
|
||||||
positionArea: position.positionArea,
|
positionArea: position.positionArea,
|
||||||
positionIsSelected: position.positionIsSelected,
|
positionIsSelected: position.positionIsSelected,
|
||||||
isSpecial: position.isSpecial,
|
isSpecial: position.isSpecial,
|
||||||
|
isOfficer: posMaster.isOfficer,
|
||||||
|
isDirecter: posMaster.isDirector,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
|
|
|
||||||
|
|
@ -563,17 +563,27 @@ export class ProfileController extends Controller {
|
||||||
where: { keycloak: request.user.sub },
|
where: { keycloak: request.user.sub },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
const _caregiver = await this.profileRepo
|
||||||
|
.createQueryBuilder("profile")
|
||||||
const _caregiver = await this.profileRepo.find({
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
relations: { posLevel: true, posType: true },
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
});
|
.skip((1 - 1) * 20)
|
||||||
const _commander = await this.profileRepo.find({
|
.take(20)
|
||||||
relations: { posLevel: true, posType: true },
|
.getMany();
|
||||||
});
|
const _commander = await this.profileRepo
|
||||||
const _chairman = await this.profileRepo.find({
|
.createQueryBuilder("profile")
|
||||||
relations: { posLevel: true, posType: true },
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
});
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.skip((1 - 1) * 20)
|
||||||
|
.take(20)
|
||||||
|
.getMany();
|
||||||
|
const _chairman = await this.profileRepo
|
||||||
|
.createQueryBuilder("profile")
|
||||||
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
.skip((1 - 1) * 20)
|
||||||
|
.take(20)
|
||||||
|
.getMany();
|
||||||
|
|
||||||
const caregiver = _caregiver.map((_data) => ({
|
const caregiver = _caregiver.map((_data) => ({
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
|
|
@ -2097,6 +2107,7 @@ export class ProfileController extends Controller {
|
||||||
child3ShortName: child3Holder?.orgChild3ShortName ?? null,
|
child3ShortName: child3Holder?.orgChild3ShortName ?? null,
|
||||||
child4: child4Holder?.orgChild4Name ?? null,
|
child4: child4Holder?.orgChild4Name ?? null,
|
||||||
child4Id: child4Holder?.id ?? null,
|
child4Id: child4Holder?.id ?? null,
|
||||||
|
child4ShortName: child4Holder?.orgChild4ShortName ?? null,
|
||||||
posMasterNo: posMasterNo ?? null,
|
posMasterNo: posMasterNo ?? null,
|
||||||
posTypeId: item.posTypeId,
|
posTypeId: item.posTypeId,
|
||||||
posTypeName: item.posType?.posTypeName,
|
posTypeName: item.posType?.posTypeName,
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
@ -557,10 +557,10 @@ export class ProfileEmployeeController extends Controller {
|
||||||
const exists =
|
const exists =
|
||||||
!!body.citizenId &&
|
!!body.citizenId &&
|
||||||
(await this.profileRepo.findOne({
|
(await this.profileRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: Not(id),
|
id: Not(id),
|
||||||
citizenId: body.citizenId,
|
citizenId: body.citizenId,
|
||||||
employeeClass: String(body.employeeClass)
|
employeeClass: String(body.employeeClass),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -690,12 +690,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
: _data.current_holders[0].orgRoot != null
|
: _data.current_holders[0].orgRoot != null
|
||||||
? `${_data.current_holders[0].orgRoot.orgRootShortName}${_data.current_holders[0].posMasterNo}`
|
? `${_data.current_holders[0].orgRoot.orgRootShortName}${_data.current_holders[0].posMasterNo}`
|
||||||
: null;
|
: null;
|
||||||
const dateEmployment =
|
const dateEmployment =
|
||||||
_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,
|
||||||
|
|
@ -933,12 +933,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
: _data.current_holders[0].orgRoot != null
|
: _data.current_holders[0].orgRoot != null
|
||||||
? `${_data.current_holders[0].orgRoot.orgRootShortName}${_data.current_holders[0].posMasterNo}`
|
? `${_data.current_holders[0].orgRoot.orgRootShortName}${_data.current_holders[0].posMasterNo}`
|
||||||
: null;
|
: null;
|
||||||
const dateEmployment =
|
const dateEmployment =
|
||||||
_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,
|
||||||
|
|
@ -2569,33 +2569,33 @@ export class ProfileEmployeeController extends Controller {
|
||||||
/**
|
/**
|
||||||
* API ข้อมูลลูกจ้างชั่วคราว
|
* API ข้อมูลลูกจ้างชั่วคราว
|
||||||
*
|
*
|
||||||
* @summary ข้อมูลลูกจ้างชั่วคราว (ADMIN)
|
* @summary ข้อมูลลูกจ้างชั่วคราว (ADMIN)
|
||||||
*
|
*
|
||||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||||
*/
|
*/
|
||||||
@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ประวัติการแก้ไขข้อมูลลูกจ้างชั่วคราว
|
* API ประวัติการแก้ไขข้อมูลลูกจ้างชั่วคราว
|
||||||
*
|
*
|
||||||
|
|
@ -2781,4 +2781,42 @@ 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่งลูกจ้าง
|
||||||
|
*
|
||||||
|
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("report")
|
||||||
|
async getReport(@Request() request: RequestWithUser) {
|
||||||
|
const profiles = await this.profileRepo.find({
|
||||||
|
where: { statusTemp: "REPORT", employeeClass: "TEMP" },
|
||||||
|
});
|
||||||
|
return new HttpSuccess(profiles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,4 @@
|
||||||
import {
|
import { Entity, Column, CreateDateColumn, UpdateDateColumn, PrimaryColumn } from "typeorm";
|
||||||
Entity,
|
|
||||||
Column,
|
|
||||||
OneToMany,
|
|
||||||
CreateDateColumn,
|
|
||||||
UpdateDateColumn,
|
|
||||||
PrimaryColumn,
|
|
||||||
} from "typeorm";
|
|
||||||
import { AuthRoleAttr } from "./AuthRoleAttr";
|
|
||||||
|
|
||||||
@Entity("authSys")
|
@Entity("authSys")
|
||||||
export class AuthSys {
|
export class AuthSys {
|
||||||
|
|
@ -16,6 +8,36 @@ export class AuthSys {
|
||||||
})
|
})
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "Id ของเมนูหลักถ้าเป็นเมนูหลักจะเป็นค่า null",
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
length: 255,
|
||||||
|
})
|
||||||
|
parentId!: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "ชื่อ icon",
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
length: 100,
|
||||||
|
})
|
||||||
|
icon!: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "path url ของระบบ",
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
length: 255,
|
||||||
|
})
|
||||||
|
path!: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "ลำดับการแสดงผล",
|
||||||
|
default: 0,
|
||||||
|
})
|
||||||
|
order: number;
|
||||||
|
|
||||||
@CreateDateColumn({ comment: "สร้างข้อมูลเมื่อ" })
|
@CreateDateColumn({ comment: "สร้างข้อมูลเมื่อ" })
|
||||||
createdAt!: Date;
|
createdAt!: Date;
|
||||||
|
|
||||||
|
|
@ -66,6 +88,9 @@ export class CreateAuthSys {
|
||||||
@PrimaryColumn()
|
@PrimaryColumn()
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
parentId: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
sysName: string;
|
sysName: string;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,12 @@ export class CreateEmployeePosMaster {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
reason: string | null;
|
reason: string | null;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
isDirector: boolean;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
isOfficer: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateEmployeePosMaster = Partial<EmployeePosMaster>;
|
export type UpdateEmployeePosMaster = Partial<EmployeePosMaster>;
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,12 @@ export class CreatePosMaster {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
reason: string | null;
|
reason: string | null;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
isDirector: boolean;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
isOfficer: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdatePosMaster = Partial<PosMaster>;
|
export type UpdatePosMaster = Partial<PosMaster>;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export class ProfileChangePosition extends EntityBase {
|
||||||
@Column({ nullable: true, comment: "วุฒิ/สาขาเดิม", default: null })
|
@Column({ nullable: true, comment: "วุฒิ/สาขาเดิม", default: null })
|
||||||
educationOld: string;
|
educationOld: string;
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "สังกัดเดิม", default: null })
|
@Column({ nullable: true, comment: "สังกัดเดิม ตำแหน่ง", default: null })
|
||||||
organizationPositionOld: string;
|
organizationPositionOld: string;
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "สังกัดเดิม", default: null })
|
@Column({ nullable: true, comment: "สังกัดเดิม", default: null })
|
||||||
|
|
@ -32,7 +32,6 @@ export class ProfileChangePosition extends EntityBase {
|
||||||
amountOld: number;
|
amountOld: number;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Column({ nullable: true, comment: "profile Id", default: null })
|
@Column({ nullable: true, comment: "profile Id", default: null })
|
||||||
profileId: string;
|
profileId: string;
|
||||||
|
|
||||||
|
|
@ -191,6 +190,9 @@ export class ProfileChangePosition extends EntityBase {
|
||||||
@Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง old", default: null })
|
@Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง old", default: null })
|
||||||
posLevelNameOld: string;
|
posLevelNameOld: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, comment: "สถานะ", type: "text", default: null })
|
||||||
|
status: string;
|
||||||
|
|
||||||
@Column({nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ChangePosition", default: null })
|
@Column({nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ChangePosition", default: null })
|
||||||
changePositionId: string;
|
changePositionId: string;
|
||||||
|
|
||||||
|
|
@ -198,3 +200,44 @@ export class ProfileChangePosition extends EntityBase {
|
||||||
@JoinColumn({ name: "changePositionId" })
|
@JoinColumn({ name: "changePositionId" })
|
||||||
profile: ChangePosition;
|
profile: ChangePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class CreateProfileChangePosition {
|
||||||
|
changePositionId: string;
|
||||||
|
profiles: ProfileItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ProfileItem {
|
||||||
|
profileId: string;
|
||||||
|
prefix: string;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
citizenId: string;
|
||||||
|
positionOld: string | null;
|
||||||
|
positionTypeOld: string | null;
|
||||||
|
positionLevelOld: string | null;
|
||||||
|
positionNumberOld: string | null;
|
||||||
|
organizationOld: string | null;
|
||||||
|
organizationPositionOld: string | null;
|
||||||
|
amountOld: number | null;
|
||||||
|
educationOld: string | null;
|
||||||
|
rootOld: string | null;
|
||||||
|
rootOldId: string | null;
|
||||||
|
rootShortNameOld: string | null;
|
||||||
|
child1Old: string | null;
|
||||||
|
child1OldId: string | null;
|
||||||
|
child1ShortNameOld: string | null;
|
||||||
|
child2Old: string | null;
|
||||||
|
child2OldId: string | null;
|
||||||
|
child2ShortNameOld: string | null;
|
||||||
|
child3Old: string | null;
|
||||||
|
child3OldId: string | null;
|
||||||
|
child3ShortNameOld: string | null;
|
||||||
|
child4Old: string | null;
|
||||||
|
child4OldId: string | null;
|
||||||
|
child4ShortNameOld: string | null;
|
||||||
|
posMasterNoOld: number | null;
|
||||||
|
posTypeOldId: string | null;
|
||||||
|
posTypeNameOld: string | null;
|
||||||
|
posLevelOldId: string | null;
|
||||||
|
posLevelNameOld: string | null;
|
||||||
|
}
|
||||||
|
|
|
||||||
22
src/migration/1718173589821-update_table_role_add_sys.ts
Normal file
22
src/migration/1718173589821-update_table_role_add_sys.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableRoleAddSys1718173589821 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableRoleAddSys1718173589821'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`DROP INDEX \`FK_b5b59c60792d518f4f025379dba\` ON \`authRoleAttr\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` ADD \`parentId\` varchar(255) NULL COMMENT 'Id ของเมนูหลักถ้าเป็นเมนูหลักจะเป็นค่า null'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` ADD \`icon\` varchar(100) NULL COMMENT 'ชื่อ icon'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` ADD \`path\` varchar(255) NULL COMMENT 'path url ของระบบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` ADD \`order\` int NOT NULL COMMENT 'ลำดับการแสดงผล' DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` DROP COLUMN \`order\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` DROP COLUMN \`path\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` DROP COLUMN \`icon\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`authSys\` DROP COLUMN \`parentId\``);
|
||||||
|
await queryRunner.query(`CREATE INDEX \`FK_b5b59c60792d518f4f025379dba\` ON \`authRoleAttr\` (\`authSysId\`)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
src/migration/1718176873613-update_table_role_add_sys1.ts
Normal file
16
src/migration/1718176873613-update_table_role_add_sys1.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableRoleAddSys11718176873613 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableRoleAddSys11718176873613'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileChangePosition\` ADD \`status\` text NULL COMMENT 'สถานะ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileChangePosition\` CHANGE \`organizationPositionOld\` \`organizationPositionOld\` varchar(255) NULL COMMENT 'สังกัดเดิม ตำแหน่ง'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileChangePosition\` CHANGE \`organizationPositionOld\` \`organizationPositionOld\` varchar(255) NULL COMMENT 'สังกัดเดิม'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileChangePosition\` DROP COLUMN \`status\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue