import data
This commit is contained in:
parent
f800e74379
commit
a11b6f152c
7 changed files with 502 additions and 283 deletions
|
|
@ -47,6 +47,10 @@ import { OFFICER } from "../entities/OFFICER";
|
||||||
import { Position } from "../entities/Position";
|
import { Position } from "../entities/Position";
|
||||||
import { PosMaster } from "../entities/PosMaster";
|
import { PosMaster } from "../entities/PosMaster";
|
||||||
import { positionOfficer } from "../entities/positionOfficer";
|
import { positionOfficer } from "../entities/positionOfficer";
|
||||||
|
import { PosExecutive } from "../entities/PosExecutive";
|
||||||
|
import { EducationLevel } from "../entities/EducationLevel";
|
||||||
|
import { HR_FUND_COURSE_CODE } from "../entities/HR_FUND_COURSE_CODE";
|
||||||
|
import { HR_MAJOR_CODE } from "../entities/HR_MAJOR_CODE";
|
||||||
// import { uuidv7 } from "uuidv7";
|
// import { uuidv7 } from "uuidv7";
|
||||||
// import { ProfileSalaries } from "../entities/ProfileSalaries";
|
// import { ProfileSalaries } from "../entities/ProfileSalaries";
|
||||||
@Route("api/v1/org/upload")
|
@Route("api/v1/org/upload")
|
||||||
|
|
@ -74,6 +78,9 @@ export class ImportDataController extends Controller {
|
||||||
private HR_PERSONAL_EMP_FAMILYRepo = AppDataSource.getRepository(HR_PERSONAL_EMP_FAMILY);
|
private HR_PERSONAL_EMP_FAMILYRepo = AppDataSource.getRepository(HR_PERSONAL_EMP_FAMILY);
|
||||||
|
|
||||||
private educationMisRepo = AppDataSource.getRepository(EducationMis);
|
private educationMisRepo = AppDataSource.getRepository(EducationMis);
|
||||||
|
private educationLevelRepo = AppDataSource.getRepository(EducationLevel);
|
||||||
|
private HR_MAJOR_CODERepo = AppDataSource.getRepository(HR_MAJOR_CODE);
|
||||||
|
private HR_FUND_COURSE_CODERepo = AppDataSource.getRepository(HR_FUND_COURSE_CODE);
|
||||||
private provincsRepo = AppDataSource.getRepository(ProvinceImport);
|
private provincsRepo = AppDataSource.getRepository(ProvinceImport);
|
||||||
private amphurRepo = AppDataSource.getRepository(AmphurImport);
|
private amphurRepo = AppDataSource.getRepository(AmphurImport);
|
||||||
private subDistrictRepo = AppDataSource.getRepository(SubDistrictImport);
|
private subDistrictRepo = AppDataSource.getRepository(SubDistrictImport);
|
||||||
|
|
@ -91,6 +98,7 @@ export class ImportDataController extends Controller {
|
||||||
private OFFICERRepo = AppDataSource.getRepository(OFFICER);
|
private OFFICERRepo = AppDataSource.getRepository(OFFICER);
|
||||||
private positionRepo = AppDataSource.getRepository(Position);
|
private positionRepo = AppDataSource.getRepository(Position);
|
||||||
private posMasterRepo = AppDataSource.getRepository(PosMaster);
|
private posMasterRepo = AppDataSource.getRepository(PosMaster);
|
||||||
|
private posExecutiveRepo = AppDataSource.getRepository(PosExecutive);
|
||||||
/**
|
/**
|
||||||
* @summary ทะเบียนประวัติ ข้าราชการ
|
* @summary ทะเบียนประวัติ ข้าราชการ
|
||||||
*/
|
*/
|
||||||
|
|
@ -199,7 +207,7 @@ export class ImportDataController extends Controller {
|
||||||
// where: { posTypeName: item.MP_Type },
|
// where: { posTypeName: item.MP_Type },
|
||||||
// });
|
// });
|
||||||
// profile.posTypeId = type?.id ?? null_;
|
// profile.posTypeId = type?.id ?? null_;
|
||||||
profile.amount = item.SALARY == "" ? 0 : Number(Extension.CheckRelationship(item.SALARY));
|
profile.amount = item.SALARY == "" ? 0 : Number(item.SALARY);
|
||||||
// profile.isLeave =
|
// profile.isLeave =
|
||||||
// item.FLAG_RETIRE_STATUSxxxx == "" || item.FLAG_RETIRE_STATUSxxxx == null ? false : true;
|
// item.FLAG_RETIRE_STATUSxxxx == "" || item.FLAG_RETIRE_STATUSxxxx == null ? false : true;
|
||||||
profile.createdUserId = request.user.sub;
|
profile.createdUserId = request.user.sub;
|
||||||
|
|
@ -409,7 +417,6 @@ export class ImportDataController extends Controller {
|
||||||
"49",
|
"49",
|
||||||
"50",
|
"50",
|
||||||
"51",
|
"51",
|
||||||
"56",
|
|
||||||
"60",
|
"60",
|
||||||
"61",
|
"61",
|
||||||
"62",
|
"62",
|
||||||
|
|
@ -427,7 +434,7 @@ export class ImportDataController extends Controller {
|
||||||
} else if (["3", "6", "34", "36", "37"].includes(item.flag_to_name_code)) {
|
} else if (["3", "6", "34", "36", "37"].includes(item.flag_to_name_code)) {
|
||||||
profileSalary.commandCode = "3";
|
profileSalary.commandCode = "3";
|
||||||
profileSalary.commandName = "แต่งตั้ง ย้าย";
|
profileSalary.commandName = "แต่งตั้ง ย้าย";
|
||||||
} else if (["10", "55"].includes(item.flag_to_name_code)) {
|
} else if (["10", "55", "56"].includes(item.flag_to_name_code)) {
|
||||||
profileSalary.commandCode = "4";
|
profileSalary.commandCode = "4";
|
||||||
profileSalary.commandName = "เลื่อน";
|
profileSalary.commandName = "เลื่อน";
|
||||||
} else if (["14"].includes(item.flag_to_name_code)) {
|
} else if (["14"].includes(item.flag_to_name_code)) {
|
||||||
|
|
@ -474,14 +481,16 @@ export class ImportDataController extends Controller {
|
||||||
profileSalary.commandCode = "17";
|
profileSalary.commandCode = "17";
|
||||||
profileSalary.commandName = "รักษาราชการ, ช่วยราชการ";
|
profileSalary.commandName = "รักษาราชการ, ช่วยราชการ";
|
||||||
}
|
}
|
||||||
if (
|
if (item.flag_to_name_code == null && item.flag_to_name == "ลาศึกษาต่อ") {
|
||||||
item.flag_to_name_code == null &&
|
|
||||||
(item.flag_to_name == "เลื่อน 1 ขั้นและเลื่อนระดับ" ||
|
|
||||||
item.flag_to_name == "เลื่อน 0.5 ขั้นและเลื่อนระดับ" ||
|
|
||||||
item.flag_to_name == "ลาศึกษาต่อ")
|
|
||||||
) {
|
|
||||||
profileSalary.commandCode = "0";
|
profileSalary.commandCode = "0";
|
||||||
profileSalary.commandName = "อื่น ๆ";
|
profileSalary.commandName = "อื่น ๆ";
|
||||||
|
} else if (
|
||||||
|
item.flag_to_name_code == null &&
|
||||||
|
(item.flag_to_name == "เลื่อน 1 ขั้นและเลื่อนระดับ" ||
|
||||||
|
item.flag_to_name == "เลื่อน 0.5 ขั้นและเลื่อนระดับ")
|
||||||
|
) {
|
||||||
|
profileSalary.commandCode = "4";
|
||||||
|
profileSalary.commandName = "เลื่อน";
|
||||||
} else if (item.flag_to_name_code == null && item.flag_to_name == "เลื่อนเงินเดือน") {
|
} else if (item.flag_to_name_code == null && item.flag_to_name == "เลื่อนเงินเดือน") {
|
||||||
profileSalary.commandCode = "5";
|
profileSalary.commandCode = "5";
|
||||||
profileSalary.commandName = "เลื่อนเงินเดือนตามปกติ";
|
profileSalary.commandName = "เลื่อนเงินเดือนตามปกติ";
|
||||||
|
|
@ -538,8 +547,6 @@ export class ImportDataController extends Controller {
|
||||||
"ขยายเวลาศึกษาต่อ",
|
"ขยายเวลาศึกษาต่อ",
|
||||||
"รายงานตัวกลับเข้าปฏิบัติราชการ",
|
"รายงานตัวกลับเข้าปฏิบัติราชการ",
|
||||||
"ไม่ได้เลื่อนขั้น",
|
"ไม่ได้เลื่อนขั้น",
|
||||||
"เลือนเงินเดือนและระดับ",
|
|
||||||
"เลื่อนเงินเดือนและระดับ",
|
|
||||||
"ตัดเงินเดือน",
|
"ตัดเงินเดือน",
|
||||||
"ลดขั้นเงินเดือน",
|
"ลดขั้นเงินเดือน",
|
||||||
"ให้ข้าราชการกลับเข้ารับราชการ",
|
"ให้ข้าราชการกลับเข้ารับราชการ",
|
||||||
|
|
@ -573,7 +580,11 @@ export class ImportDataController extends Controller {
|
||||||
) {
|
) {
|
||||||
profileSalary.commandCode = "3";
|
profileSalary.commandCode = "3";
|
||||||
profileSalary.commandName = "แต่งตั้ง ย้าย";
|
profileSalary.commandName = "แต่งตั้ง ย้าย";
|
||||||
} else if (["เลื่อนและแต่งตั้ง", "เลื่อนระดับ"].includes(item.flag_to_name)) {
|
} else if (
|
||||||
|
["เลื่อนและแต่งตั้ง", "เลื่อนระดับ", "เลื่อนเงินเดือนและระดับ"].includes(
|
||||||
|
item.flag_to_name,
|
||||||
|
)
|
||||||
|
) {
|
||||||
profileSalary.commandCode = "4";
|
profileSalary.commandCode = "4";
|
||||||
profileSalary.commandName = "เลื่อน";
|
profileSalary.commandName = "เลื่อน";
|
||||||
} else if (["เลื่อนขั้นเงินเดือน", "เลื่อนเงินเดือน"].includes(item.flag_to_name)) {
|
} else if (["เลื่อนขั้นเงินเดือน", "เลื่อนเงินเดือน"].includes(item.flag_to_name)) {
|
||||||
|
|
@ -1228,69 +1239,71 @@ export class ImportDataController extends Controller {
|
||||||
// .take(5)
|
// .take(5)
|
||||||
// .getMany();
|
// .getMany();
|
||||||
|
|
||||||
await Promise.all(
|
for (const _item of profiles) {
|
||||||
profiles.map(async (_item) => {
|
const existingProfile = await this.HR_EDUCATIONRepo.find({
|
||||||
const existingProfile = await this.HR_EDUCATIONRepo.find({
|
where: { CIT: _item.citizenId },
|
||||||
where: { CIT: _item.citizenId },
|
select: [
|
||||||
select: [
|
"CIT",
|
||||||
"CIT",
|
"EDUCATION_CODE",
|
||||||
"EDUCATION_CODE",
|
"START_EDUCATION_YEAR",
|
||||||
"START_EDUCATION_YEAR",
|
"EDUCATION_YEAR",
|
||||||
"EDUCATION_YEAR",
|
"INSTITUE",
|
||||||
"INSTITUE",
|
"EDUCATION_SEQ",
|
||||||
"EDUCATION_SEQ",
|
],
|
||||||
],
|
});
|
||||||
|
|
||||||
|
const educationLevel = await this.profileEducationRepo.findOne({
|
||||||
|
select: ["id", "level", "profileId"],
|
||||||
|
where: { profileId: _item.id },
|
||||||
|
order: { level: "DESC" },
|
||||||
|
});
|
||||||
|
|
||||||
|
// educations = await [];
|
||||||
|
for (const item of existingProfile) {
|
||||||
|
rowCount++;
|
||||||
|
const education = new ProfileEducation();
|
||||||
|
const educationCode = await this.educationMisRepo.findOne({
|
||||||
|
where: { EDUCATION_CODE: item.EDUCATION_CODE },
|
||||||
|
});
|
||||||
|
const hrMajorCode = await this.HR_MAJOR_CODERepo.findOne({
|
||||||
|
where: { MAJOR_CODE: item.MAJOR_CODE },
|
||||||
|
});
|
||||||
|
const hrFundCourseCode = await this.HR_FUND_COURSE_CODERepo.findOne({
|
||||||
|
where: { FUND_COURSE_CODE: item.FUND_COURSE_CODE },
|
||||||
});
|
});
|
||||||
|
|
||||||
const educationLevel = await this.profileEducationRepo.findOne({
|
let startDate = item.START_EDUCATION_YEAR
|
||||||
select: ["id", "level", "profileId"],
|
? Extension.ConvertToDateTimeV2(item.START_EDUCATION_YEAR)
|
||||||
where: { profileId: _item.id },
|
: null_;
|
||||||
order: { level: "DESC" },
|
// startDate = startDate ? new Date(startDate, 0, 1) : null_;
|
||||||
});
|
|
||||||
|
|
||||||
// educations = await [];
|
let endDate = item.EDUCATION_YEAR
|
||||||
await Promise.all(
|
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
|
||||||
existingProfile.map(async (item) => {
|
: null_;
|
||||||
rowCount++;
|
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
|
||||||
const education = new ProfileEducation();
|
|
||||||
const educationCode = await this.educationMisRepo.findOne({
|
|
||||||
where: { EDUCATION_CODE: item.EDUCATION_CODE },
|
|
||||||
});
|
|
||||||
|
|
||||||
let startDate = item.START_EDUCATION_YEAR
|
education.level = educationLevel == null ? 1 : educationLevel.level + 1;
|
||||||
? Extension.ConvertToDateTimeV2(item.START_EDUCATION_YEAR)
|
education.profileId = _item.id;
|
||||||
: null_;
|
education.degree = educationCode ? educationCode.EDUCATION_NAME : null_;
|
||||||
// startDate = startDate ? new Date(startDate, 0, 1) : null_;
|
education.field = hrMajorCode ? hrMajorCode.MAJOR_NAME : null_;
|
||||||
|
education.educationLevelId = hrFundCourseCode ? hrFundCourseCode.refId : null_;
|
||||||
let endDate = item.EDUCATION_YEAR
|
education.institute = item.INSTITUE;
|
||||||
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
|
education.level = item.EDUCATION_SEQ ? null_ : Number(item.EDUCATION_SEQ);
|
||||||
: null_;
|
education.startDate = startDate;
|
||||||
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
|
education.endDate = endDate;
|
||||||
|
education.createdUserId = request.user.sub;
|
||||||
education.level = educationLevel == null ? 1 : educationLevel.level + 1;
|
education.createdFullName = request.user.name;
|
||||||
education.profileId = _item.id;
|
education.lastUpdateUserId = request.user.sub;
|
||||||
education.degree = educationCode ? educationCode.EDUCATION_ABB_NAME : "";
|
education.lastUpdateFullName = request.user.name;
|
||||||
// education.degree = educationCode ? educationCode.MAJOR_NAME: "";
|
education.createdAt = new Date();
|
||||||
// education.degree = educationCode ? educationCode.FUND_COURSE_CODE: "";
|
education.lastUpdatedAt = new Date();
|
||||||
education.institute = item.INSTITUE;
|
// await educations.push(await education);
|
||||||
education.level = item.EDUCATION_SEQ ? null_ : Number(item.EDUCATION_SEQ);
|
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||||
education.startDate = startDate;
|
await this.profileEducationRepo.save(await education);
|
||||||
education.endDate = endDate;
|
}
|
||||||
education.createdUserId = request.user.sub;
|
// await this.profileEducationRepo.save(educations);
|
||||||
education.createdFullName = request.user.name;
|
// educations = await [];
|
||||||
education.lastUpdateUserId = request.user.sub;
|
}
|
||||||
education.lastUpdateFullName = request.user.name;
|
|
||||||
education.createdAt = new Date();
|
|
||||||
education.lastUpdatedAt = new Date();
|
|
||||||
// await educations.push(await education);
|
|
||||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
|
||||||
await this.profileEducationRepo.save(await education);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
// await this.profileEducationRepo.save(educations);
|
|
||||||
// educations = await [];
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
// }
|
// }
|
||||||
// console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
// console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||||
// await this.profileEducationRepo.save(educations);
|
// await this.profileEducationRepo.save(educations);
|
||||||
|
|
@ -1878,11 +1891,50 @@ export class ImportDataController extends Controller {
|
||||||
orgChild3: "",
|
orgChild3: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
let order = 1;
|
||||||
|
for (const item of IMPORT_CHILD) {
|
||||||
|
const orgRoot = new OrgRoot();
|
||||||
|
orgRoot.orgRootOrder = order;
|
||||||
|
orgRoot.orgRootName = item.orgRoot;
|
||||||
|
orgRoot.orgRootShortName = item.orgShortname;
|
||||||
|
const rank: any = item.orgRank;
|
||||||
|
orgRoot.orgRootRank = rank;
|
||||||
|
orgRoot.orgRootRankSub = item.orgSubRank;
|
||||||
|
orgRoot.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
|
orgRoot.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
|
orgRoot.SECTION_CODE = item.SECTION_CODE;
|
||||||
|
orgRoot.JOB_CODE = item.JOB_CODE;
|
||||||
|
orgRoot.orgRevisionId = orgRevision.id;
|
||||||
|
orgRoot.createdUserId = request.user.sub;
|
||||||
|
orgRoot.createdFullName = request.user.name;
|
||||||
|
orgRoot.lastUpdateUserId = request.user.sub;
|
||||||
|
orgRoot.lastUpdateFullName = request.user.name;
|
||||||
|
orgRoot.createdAt = new Date();
|
||||||
|
orgRoot.lastUpdatedAt = new Date();
|
||||||
|
await this.orgRootRepo.save(orgRoot);
|
||||||
|
order++;
|
||||||
|
}
|
||||||
|
|
||||||
//order xxxxxxxxxxxxxxxx
|
//create child1
|
||||||
await Promise.all(
|
const IMPORT_CHILD1 = await this.IMPORT_ORGRepo.find({
|
||||||
IMPORT_CHILD.map(async (item) => {
|
where: {
|
||||||
const orgRoot = new OrgRoot();
|
orgRoot: Not(""),
|
||||||
|
orgChild1: Not(""),
|
||||||
|
orgChild2: "",
|
||||||
|
orgChild3: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const item of IMPORT_CHILD1) {
|
||||||
|
const orgChild1 = new OrgChild1();
|
||||||
|
let orgRoot = await this.orgRootRepo.findOne({
|
||||||
|
where: { orgRootName: item.orgRoot },
|
||||||
|
relations: ["orgChild1s"],
|
||||||
|
});
|
||||||
|
if (orgRoot == null) {
|
||||||
|
orgRoot = new OrgRoot();
|
||||||
|
orgRoot.orgRootOrder = order;
|
||||||
|
order = order + 1;
|
||||||
orgRoot.orgRootName = item.orgRoot;
|
orgRoot.orgRootName = item.orgRoot;
|
||||||
orgRoot.orgRootShortName = item.orgShortname;
|
orgRoot.orgRootShortName = item.orgShortname;
|
||||||
const rank: any = item.orgRank;
|
const rank: any = item.orgRank;
|
||||||
|
|
@ -1900,46 +1952,171 @@ export class ImportDataController extends Controller {
|
||||||
orgRoot.createdAt = new Date();
|
orgRoot.createdAt = new Date();
|
||||||
orgRoot.lastUpdatedAt = new Date();
|
orgRoot.lastUpdatedAt = new Date();
|
||||||
await this.orgRootRepo.save(orgRoot);
|
await this.orgRootRepo.save(orgRoot);
|
||||||
}),
|
}
|
||||||
);
|
|
||||||
|
|
||||||
//create child1
|
orgChild1.orgChild1Order =
|
||||||
const IMPORT_CHILD1 = await this.IMPORT_ORGRepo.find({
|
orgRoot == null || orgRoot.orgChild1s == null || orgRoot.orgChild1s.length == 0
|
||||||
|
? 1
|
||||||
|
: orgRoot.orgChild1s.length + 1;
|
||||||
|
orgChild1.orgRootId = orgRoot.id;
|
||||||
|
orgChild1.orgChild1Name = item.orgChild1;
|
||||||
|
orgChild1.orgChild1ShortName = item.orgShortname;
|
||||||
|
const rank: any = item.orgRank;
|
||||||
|
orgChild1.orgChild1Rank = rank;
|
||||||
|
orgChild1.orgChild1RankSub = item.orgSubRank;
|
||||||
|
orgChild1.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
|
orgChild1.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
|
orgChild1.SECTION_CODE = item.SECTION_CODE;
|
||||||
|
orgChild1.JOB_CODE = item.JOB_CODE;
|
||||||
|
orgChild1.orgRevisionId = orgRevision.id;
|
||||||
|
orgChild1.createdUserId = request.user.sub;
|
||||||
|
orgChild1.createdFullName = request.user.name;
|
||||||
|
orgChild1.lastUpdateUserId = request.user.sub;
|
||||||
|
orgChild1.lastUpdateFullName = request.user.name;
|
||||||
|
orgChild1.createdAt = new Date();
|
||||||
|
orgChild1.lastUpdatedAt = new Date();
|
||||||
|
await this.orgChild1Repo.save(orgChild1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//create child2
|
||||||
|
const IMPORT_CHILD2 = await this.IMPORT_ORGRepo.find({
|
||||||
where: {
|
where: {
|
||||||
orgRoot: Not(""),
|
orgRoot: Not(""),
|
||||||
orgChild1: Not(""),
|
orgChild1: Not(""),
|
||||||
orgChild2: "",
|
orgChild2: Not(""),
|
||||||
orgChild3: "",
|
orgChild3: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
for (const item of IMPORT_CHILD2) {
|
||||||
|
const orgChild2 = new OrgChild2();
|
||||||
|
let orgRoot = await this.orgRootRepo.findOne({
|
||||||
|
where: { orgRootName: item.orgRoot },
|
||||||
|
relations: ["orgChild1s"],
|
||||||
|
});
|
||||||
|
if (orgRoot == null) {
|
||||||
|
orgRoot = new OrgRoot();
|
||||||
|
orgRoot.orgRootOrder = order;
|
||||||
|
order = order + 1;
|
||||||
|
orgRoot.orgRootName = item.orgRoot;
|
||||||
|
orgRoot.orgRootShortName = item.orgShortname;
|
||||||
|
const rank: any = item.orgRank;
|
||||||
|
orgRoot.orgRootRank = rank;
|
||||||
|
orgRoot.orgRootRankSub = item.orgSubRank;
|
||||||
|
orgRoot.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
|
orgRoot.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
|
orgRoot.SECTION_CODE = item.SECTION_CODE;
|
||||||
|
orgRoot.JOB_CODE = item.JOB_CODE;
|
||||||
|
orgRoot.orgRevisionId = orgRevision.id;
|
||||||
|
orgRoot.createdUserId = request.user.sub;
|
||||||
|
orgRoot.createdFullName = request.user.name;
|
||||||
|
orgRoot.lastUpdateUserId = request.user.sub;
|
||||||
|
orgRoot.lastUpdateFullName = request.user.name;
|
||||||
|
orgRoot.createdAt = new Date();
|
||||||
|
orgRoot.lastUpdatedAt = new Date();
|
||||||
|
await this.orgRootRepo.save(orgRoot);
|
||||||
|
}
|
||||||
|
let orgChild1 = await this.orgChild1Repo.findOne({
|
||||||
|
where: { orgChild1Name: item.orgChild1 },
|
||||||
|
relations: ["orgChild2s"],
|
||||||
|
});
|
||||||
|
if (orgChild1 == null) {
|
||||||
|
orgChild1 = new OrgChild1();
|
||||||
|
orgChild1.orgRootId = orgRoot.id;
|
||||||
|
orgChild1.orgChild1Order =
|
||||||
|
orgRoot == null || orgRoot.orgChild1s == null || orgRoot.orgChild1s.length == 0
|
||||||
|
? 1
|
||||||
|
: orgRoot.orgChild1s.length + 1;
|
||||||
|
orgChild1.orgChild1Name = item.orgChild1;
|
||||||
|
orgChild1.orgChild1ShortName = item.orgShortname;
|
||||||
|
const rank: any = item.orgRank;
|
||||||
|
orgChild1.orgChild1Rank = rank;
|
||||||
|
orgChild1.orgChild1RankSub = item.orgSubRank;
|
||||||
|
orgChild1.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
|
orgChild1.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
|
orgChild1.SECTION_CODE = item.SECTION_CODE;
|
||||||
|
orgChild1.JOB_CODE = item.JOB_CODE;
|
||||||
|
orgChild1.orgRevisionId = orgRevision.id;
|
||||||
|
orgChild1.createdUserId = request.user.sub;
|
||||||
|
orgChild1.createdFullName = request.user.name;
|
||||||
|
orgChild1.lastUpdateUserId = request.user.sub;
|
||||||
|
orgChild1.lastUpdateFullName = request.user.name;
|
||||||
|
orgChild1.createdAt = new Date();
|
||||||
|
orgChild1.lastUpdatedAt = new Date();
|
||||||
|
await this.orgChild1Repo.save(orgChild1);
|
||||||
|
}
|
||||||
|
orgChild2.orgChild2Order =
|
||||||
|
orgChild1 == null || orgChild1.orgChild2s == null || orgChild1.orgChild2s.length == 0
|
||||||
|
? 1
|
||||||
|
: orgChild1.orgChild2s.length + 1;
|
||||||
|
orgChild2.orgRootId = orgRoot.id;
|
||||||
|
orgChild2.orgChild1Id = orgChild1.id;
|
||||||
|
orgChild2.orgChild2Name = item.orgChild2;
|
||||||
|
orgChild2.orgChild2ShortName = item.orgShortname;
|
||||||
|
const rank: any = item.orgRank;
|
||||||
|
orgChild2.orgChild2Rank = rank;
|
||||||
|
orgChild2.orgChild2RankSub = item.orgSubRank;
|
||||||
|
orgChild2.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
|
orgChild2.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
|
orgChild2.SECTION_CODE = item.SECTION_CODE;
|
||||||
|
orgChild2.JOB_CODE = item.JOB_CODE;
|
||||||
|
orgChild2.orgRevisionId = orgRevision.id;
|
||||||
|
orgChild2.createdUserId = request.user.sub;
|
||||||
|
orgChild2.createdFullName = request.user.name;
|
||||||
|
orgChild2.lastUpdateUserId = request.user.sub;
|
||||||
|
orgChild2.lastUpdateFullName = request.user.name;
|
||||||
|
orgChild2.createdAt = new Date();
|
||||||
|
orgChild2.lastUpdatedAt = new Date();
|
||||||
|
await this.orgChild2Repo.save(orgChild2);
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all(
|
//create child3
|
||||||
IMPORT_CHILD1.map(async (item) => {
|
const IMPORT_CHILD3 = await this.IMPORT_ORGRepo.find({
|
||||||
const orgChild1 = new OrgChild1();
|
where: {
|
||||||
let orgRoot = await this.orgRootRepo.findOne({
|
orgRoot: Not(""),
|
||||||
where: { orgRootName: item.orgRoot },
|
orgChild1: Not(""),
|
||||||
});
|
orgChild2: Not(""),
|
||||||
if (orgRoot == null) {
|
orgChild3: Not(""),
|
||||||
orgRoot = new OrgRoot();
|
},
|
||||||
orgRoot.orgRootName = item.orgRoot;
|
});
|
||||||
orgRoot.orgRootShortName = item.orgShortname;
|
|
||||||
const rank: any = item.orgRank;
|
|
||||||
orgRoot.orgRootRank = rank;
|
|
||||||
orgRoot.orgRootRankSub = item.orgSubRank;
|
|
||||||
orgRoot.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgRoot.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgRoot.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgRoot.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgRoot.orgRevisionId = orgRevision.id;
|
|
||||||
orgRoot.createdUserId = request.user.sub;
|
|
||||||
orgRoot.createdFullName = request.user.name;
|
|
||||||
orgRoot.lastUpdateUserId = request.user.sub;
|
|
||||||
orgRoot.lastUpdateFullName = request.user.name;
|
|
||||||
orgRoot.createdAt = new Date();
|
|
||||||
orgRoot.lastUpdatedAt = new Date();
|
|
||||||
await this.orgRootRepo.save(orgRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (const item of IMPORT_CHILD3) {
|
||||||
|
const orgChild3 = new OrgChild3();
|
||||||
|
let orgRoot = await this.orgRootRepo.findOne({
|
||||||
|
where: { orgRootName: item.orgRoot },
|
||||||
|
relations: ["orgChild1s"],
|
||||||
|
});
|
||||||
|
if (orgRoot == null) {
|
||||||
|
orgRoot = new OrgRoot();
|
||||||
|
orgRoot.orgRootOrder = order;
|
||||||
|
order = order + 1;
|
||||||
|
orgRoot.orgRootName = item.orgRoot;
|
||||||
|
orgRoot.orgRootShortName = item.orgShortname;
|
||||||
|
const rank: any = item.orgRank;
|
||||||
|
orgRoot.orgRootRank = rank;
|
||||||
|
orgRoot.orgRootRankSub = item.orgSubRank;
|
||||||
|
orgRoot.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
|
orgRoot.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
|
orgRoot.SECTION_CODE = item.SECTION_CODE;
|
||||||
|
orgRoot.JOB_CODE = item.JOB_CODE;
|
||||||
|
orgRoot.orgRevisionId = orgRevision.id;
|
||||||
|
orgRoot.createdUserId = request.user.sub;
|
||||||
|
orgRoot.createdFullName = request.user.name;
|
||||||
|
orgRoot.lastUpdateUserId = request.user.sub;
|
||||||
|
orgRoot.lastUpdateFullName = request.user.name;
|
||||||
|
orgRoot.createdAt = new Date();
|
||||||
|
orgRoot.lastUpdatedAt = new Date();
|
||||||
|
await this.orgRootRepo.save(orgRoot);
|
||||||
|
}
|
||||||
|
let orgChild1 = await this.orgChild1Repo.findOne({
|
||||||
|
where: { orgChild1Name: item.orgChild1 },
|
||||||
|
relations: ["orgChild2s"],
|
||||||
|
});
|
||||||
|
if (orgChild1 == null) {
|
||||||
|
orgChild1 = new OrgChild1();
|
||||||
|
orgChild1.orgChild1Order =
|
||||||
|
orgRoot == null || orgRoot.orgChild1s == null || orgRoot.orgChild1s.length == 0
|
||||||
|
? 1
|
||||||
|
: orgRoot.orgChild1s.length + 1;
|
||||||
orgChild1.orgRootId = orgRoot.id;
|
orgChild1.orgRootId = orgRoot.id;
|
||||||
orgChild1.orgChild1Name = item.orgChild1;
|
orgChild1.orgChild1Name = item.orgChild1;
|
||||||
orgChild1.orgChild1ShortName = item.orgShortname;
|
orgChild1.orgChild1ShortName = item.orgShortname;
|
||||||
|
|
@ -1958,68 +2135,17 @@ export class ImportDataController extends Controller {
|
||||||
orgChild1.createdAt = new Date();
|
orgChild1.createdAt = new Date();
|
||||||
orgChild1.lastUpdatedAt = new Date();
|
orgChild1.lastUpdatedAt = new Date();
|
||||||
await this.orgChild1Repo.save(orgChild1);
|
await this.orgChild1Repo.save(orgChild1);
|
||||||
}),
|
}
|
||||||
);
|
let orgChild2 = await this.orgChild2Repo.findOne({
|
||||||
|
where: { orgChild2Name: item.orgChild2 },
|
||||||
//create child2
|
relations: ["orgChild3s"],
|
||||||
const IMPORT_CHILD2 = await this.IMPORT_ORGRepo.find({
|
});
|
||||||
where: {
|
if (orgChild2 == null) {
|
||||||
orgRoot: Not(""),
|
orgChild2 = new OrgChild2();
|
||||||
orgChild1: Not(""),
|
orgChild2.orgChild2Order =
|
||||||
orgChild2: Not(""),
|
orgChild1 == null || orgChild1.orgChild2s == null || orgChild1.orgChild2s.length == 0
|
||||||
orgChild3: "",
|
? 1
|
||||||
},
|
: orgChild1.orgChild2s.length + 1;
|
||||||
});
|
|
||||||
await Promise.all(
|
|
||||||
IMPORT_CHILD2.map(async (item) => {
|
|
||||||
const orgChild2 = new OrgChild2();
|
|
||||||
let orgRoot = await this.orgRootRepo.findOne({
|
|
||||||
where: { orgRootName: item.orgRoot },
|
|
||||||
});
|
|
||||||
if (orgRoot == null) {
|
|
||||||
orgRoot = new OrgRoot();
|
|
||||||
orgRoot.orgRootName = item.orgRoot;
|
|
||||||
orgRoot.orgRootShortName = item.orgShortname;
|
|
||||||
const rank: any = item.orgRank;
|
|
||||||
orgRoot.orgRootRank = rank;
|
|
||||||
orgRoot.orgRootRankSub = item.orgSubRank;
|
|
||||||
orgRoot.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgRoot.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgRoot.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgRoot.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgRoot.orgRevisionId = orgRevision.id;
|
|
||||||
orgRoot.createdUserId = request.user.sub;
|
|
||||||
orgRoot.createdFullName = request.user.name;
|
|
||||||
orgRoot.lastUpdateUserId = request.user.sub;
|
|
||||||
orgRoot.lastUpdateFullName = request.user.name;
|
|
||||||
orgRoot.createdAt = new Date();
|
|
||||||
orgRoot.lastUpdatedAt = new Date();
|
|
||||||
await this.orgRootRepo.save(orgRoot);
|
|
||||||
}
|
|
||||||
let orgChild1 = await this.orgChild1Repo.findOne({
|
|
||||||
where: { orgChild1Name: item.orgChild1 },
|
|
||||||
});
|
|
||||||
if (orgChild1 == null) {
|
|
||||||
orgChild1 = new OrgChild1();
|
|
||||||
orgChild1.orgRootId = orgRoot.id;
|
|
||||||
orgChild1.orgChild1Name = item.orgChild1;
|
|
||||||
orgChild1.orgChild1ShortName = item.orgShortname;
|
|
||||||
const rank: any = item.orgRank;
|
|
||||||
orgChild1.orgChild1Rank = rank;
|
|
||||||
orgChild1.orgChild1RankSub = item.orgSubRank;
|
|
||||||
orgChild1.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgChild1.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgChild1.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgChild1.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgChild1.orgRevisionId = orgRevision.id;
|
|
||||||
orgChild1.createdUserId = request.user.sub;
|
|
||||||
orgChild1.createdFullName = request.user.name;
|
|
||||||
orgChild1.lastUpdateUserId = request.user.sub;
|
|
||||||
orgChild1.lastUpdateFullName = request.user.name;
|
|
||||||
orgChild1.createdAt = new Date();
|
|
||||||
orgChild1.lastUpdatedAt = new Date();
|
|
||||||
await this.orgChild1Repo.save(orgChild1);
|
|
||||||
}
|
|
||||||
orgChild2.orgRootId = orgRoot.id;
|
orgChild2.orgRootId = orgRoot.id;
|
||||||
orgChild2.orgChild1Id = orgChild1.id;
|
orgChild2.orgChild1Id = orgChild1.id;
|
||||||
orgChild2.orgChild2Name = item.orgChild2;
|
orgChild2.orgChild2Name = item.orgChild2;
|
||||||
|
|
@ -2039,117 +2165,32 @@ export class ImportDataController extends Controller {
|
||||||
orgChild2.createdAt = new Date();
|
orgChild2.createdAt = new Date();
|
||||||
orgChild2.lastUpdatedAt = new Date();
|
orgChild2.lastUpdatedAt = new Date();
|
||||||
await this.orgChild2Repo.save(orgChild2);
|
await this.orgChild2Repo.save(orgChild2);
|
||||||
}),
|
}
|
||||||
);
|
orgChild3.orgChild3Order =
|
||||||
|
orgChild2 == null || orgChild2.orgChild3s == null || orgChild2.orgChild3s.length == 0
|
||||||
//create child3
|
? 1
|
||||||
const IMPORT_CHILD3 = await this.IMPORT_ORGRepo.find({
|
: orgChild2.orgChild3s.length + 1;
|
||||||
where: {
|
orgChild3.orgRootId = orgRoot.id;
|
||||||
orgRoot: Not(""),
|
orgChild3.orgChild1Id = orgChild1.id;
|
||||||
orgChild1: Not(""),
|
orgChild3.orgChild2Id = orgChild2.id;
|
||||||
orgChild2: Not(""),
|
orgChild3.orgChild3Name = item.orgChild3;
|
||||||
orgChild3: Not(""),
|
orgChild3.orgChild3ShortName = item.orgShortname;
|
||||||
},
|
const rank: any = item.orgRank;
|
||||||
});
|
orgChild3.orgChild3Rank = rank;
|
||||||
|
orgChild3.orgChild3RankSub = item.orgSubRank;
|
||||||
await Promise.all(
|
orgChild3.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
||||||
IMPORT_CHILD3.map(async (item) => {
|
orgChild3.DIVISION_CODE = item.DIVISION_CODE;
|
||||||
const orgChild3 = new OrgChild3();
|
orgChild3.SECTION_CODE = item.SECTION_CODE;
|
||||||
let orgRoot = await this.orgRootRepo.findOne({
|
orgChild3.JOB_CODE = item.JOB_CODE;
|
||||||
where: { orgRootName: item.orgRoot },
|
orgChild3.orgRevisionId = orgRevision.id;
|
||||||
});
|
orgChild3.createdUserId = request.user.sub;
|
||||||
if (orgRoot == null) {
|
orgChild3.createdFullName = request.user.name;
|
||||||
orgRoot = new OrgRoot();
|
orgChild3.lastUpdateUserId = request.user.sub;
|
||||||
orgRoot.orgRootName = item.orgRoot;
|
orgChild3.lastUpdateFullName = request.user.name;
|
||||||
orgRoot.orgRootShortName = item.orgShortname;
|
orgChild3.createdAt = new Date();
|
||||||
const rank: any = item.orgRank;
|
orgChild3.lastUpdatedAt = new Date();
|
||||||
orgRoot.orgRootRank = rank;
|
await this.orgChild3Repo.save(orgChild3);
|
||||||
orgRoot.orgRootRankSub = item.orgSubRank;
|
}
|
||||||
orgRoot.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgRoot.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgRoot.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgRoot.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgRoot.orgRevisionId = orgRevision.id;
|
|
||||||
orgRoot.createdUserId = request.user.sub;
|
|
||||||
orgRoot.createdFullName = request.user.name;
|
|
||||||
orgRoot.lastUpdateUserId = request.user.sub;
|
|
||||||
orgRoot.lastUpdateFullName = request.user.name;
|
|
||||||
orgRoot.createdAt = new Date();
|
|
||||||
orgRoot.lastUpdatedAt = new Date();
|
|
||||||
await this.orgRootRepo.save(orgRoot);
|
|
||||||
}
|
|
||||||
let orgChild1 = await this.orgChild1Repo.findOne({
|
|
||||||
where: { orgChild1Name: item.orgChild1 },
|
|
||||||
});
|
|
||||||
if (orgChild1 == null) {
|
|
||||||
orgChild1 = new OrgChild1();
|
|
||||||
orgChild1.orgRootId = orgRoot.id;
|
|
||||||
orgChild1.orgChild1Name = item.orgChild1;
|
|
||||||
orgChild1.orgChild1ShortName = item.orgShortname;
|
|
||||||
const rank: any = item.orgRank;
|
|
||||||
orgChild1.orgChild1Rank = rank;
|
|
||||||
orgChild1.orgChild1RankSub = item.orgSubRank;
|
|
||||||
orgChild1.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgChild1.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgChild1.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgChild1.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgChild1.orgRevisionId = orgRevision.id;
|
|
||||||
orgChild1.createdUserId = request.user.sub;
|
|
||||||
orgChild1.createdFullName = request.user.name;
|
|
||||||
orgChild1.lastUpdateUserId = request.user.sub;
|
|
||||||
orgChild1.lastUpdateFullName = request.user.name;
|
|
||||||
orgChild1.createdAt = new Date();
|
|
||||||
orgChild1.lastUpdatedAt = new Date();
|
|
||||||
await this.orgChild1Repo.save(orgChild1);
|
|
||||||
}
|
|
||||||
let orgChild2 = await this.orgChild2Repo.findOne({
|
|
||||||
where: { orgChild2Name: item.orgChild2 },
|
|
||||||
});
|
|
||||||
if (orgChild2 == null) {
|
|
||||||
orgChild2 = new OrgChild2();
|
|
||||||
orgChild2.orgRootId = orgRoot.id;
|
|
||||||
orgChild2.orgChild1Id = orgChild1.id;
|
|
||||||
orgChild2.orgChild2Name = item.orgChild2;
|
|
||||||
orgChild2.orgChild2ShortName = item.orgShortname;
|
|
||||||
const rank: any = item.orgRank;
|
|
||||||
orgChild2.orgChild2Rank = rank;
|
|
||||||
orgChild2.orgChild2RankSub = item.orgSubRank;
|
|
||||||
orgChild2.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgChild2.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgChild2.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgChild2.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgChild2.orgRevisionId = orgRevision.id;
|
|
||||||
orgChild2.createdUserId = request.user.sub;
|
|
||||||
orgChild2.createdFullName = request.user.name;
|
|
||||||
orgChild2.lastUpdateUserId = request.user.sub;
|
|
||||||
orgChild2.lastUpdateFullName = request.user.name;
|
|
||||||
orgChild2.createdAt = new Date();
|
|
||||||
orgChild2.lastUpdatedAt = new Date();
|
|
||||||
await this.orgChild2Repo.save(orgChild2);
|
|
||||||
}
|
|
||||||
|
|
||||||
orgChild3.orgRootId = orgRoot.id;
|
|
||||||
orgChild3.orgChild1Id = orgChild1.id;
|
|
||||||
orgChild3.orgChild2Id = orgChild2.id;
|
|
||||||
orgChild3.orgChild3Name = item.orgChild3;
|
|
||||||
orgChild3.orgChild3ShortName = item.orgShortname;
|
|
||||||
const rank: any = item.orgRank;
|
|
||||||
orgChild3.orgChild3Rank = rank;
|
|
||||||
orgChild3.orgChild3RankSub = item.orgSubRank;
|
|
||||||
orgChild3.DEPARTMENT_CODE = item.DEPARTMENT_CODE;
|
|
||||||
orgChild3.DIVISION_CODE = item.DIVISION_CODE;
|
|
||||||
orgChild3.SECTION_CODE = item.SECTION_CODE;
|
|
||||||
orgChild3.JOB_CODE = item.JOB_CODE;
|
|
||||||
orgChild3.orgRevisionId = orgRevision.id;
|
|
||||||
orgChild3.createdUserId = request.user.sub;
|
|
||||||
orgChild3.createdFullName = request.user.name;
|
|
||||||
orgChild3.lastUpdateUserId = request.user.sub;
|
|
||||||
orgChild3.lastUpdateFullName = request.user.name;
|
|
||||||
orgChild3.createdAt = new Date();
|
|
||||||
orgChild3.lastUpdatedAt = new Date();
|
|
||||||
await this.orgChild3Repo.save(orgChild3);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -2174,7 +2215,7 @@ export class ImportDataController extends Controller {
|
||||||
rowCount++;
|
rowCount++;
|
||||||
|
|
||||||
const existingProfile = await this.profileRepo.findOne({
|
const existingProfile = await this.profileRepo.findOne({
|
||||||
where: { citizenId: item.id.toString() },
|
where: { citizenId: item.CIT },
|
||||||
});
|
});
|
||||||
if (existingProfile == null) {
|
if (existingProfile == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2270,6 +2311,31 @@ export class ImportDataController extends Controller {
|
||||||
position.lastUpdateFullName = request.user.name;
|
position.lastUpdateFullName = request.user.name;
|
||||||
position.createdAt = new Date();
|
position.createdAt = new Date();
|
||||||
position.lastUpdatedAt = new Date();
|
position.lastUpdatedAt = new Date();
|
||||||
|
|
||||||
|
const posExecutive = await this.posExecutiveRepo.findOne({
|
||||||
|
where: {
|
||||||
|
posExecutiveName: item.ADMIN_NAME,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (posExecutive == null && item.ADMIN_NAME != "" && item.ADMIN_NAME != null) {
|
||||||
|
const posExecutiveOrder = await this.posExecutiveRepo.findOne({
|
||||||
|
where: { posExecutivePriority: Not(IsNull()) },
|
||||||
|
order: { posExecutivePriority: "DESC" },
|
||||||
|
});
|
||||||
|
let posExecutive = new PosExecutive();
|
||||||
|
|
||||||
|
posExecutive.posExecutivePriority =
|
||||||
|
posExecutiveOrder == null ? null_ : posExecutiveOrder.posExecutivePriority + 1;
|
||||||
|
posExecutive.posExecutiveName = item.ADMIN_NAME;
|
||||||
|
posExecutive.createdUserId = request.user.sub;
|
||||||
|
posExecutive.createdFullName = request.user.name;
|
||||||
|
posExecutive.lastUpdateUserId = request.user.sub;
|
||||||
|
posExecutive.lastUpdateFullName = request.user.name;
|
||||||
|
posExecutive.createdAt = new Date();
|
||||||
|
posExecutive.lastUpdatedAt = new Date();
|
||||||
|
await this.posExecutiveRepo.save(posExecutive);
|
||||||
|
}
|
||||||
|
position.posExecutiveId = posExecutive == null ? null_ : posExecutive.id;
|
||||||
position.positionName = item.WORK_LINE_NAME == "" ? null_ : item.WORK_LINE_NAME;
|
position.positionName = item.WORK_LINE_NAME == "" ? null_ : item.WORK_LINE_NAME;
|
||||||
position.posTypeId =
|
position.posTypeId =
|
||||||
type_ != null && type_.posTypeName == item.MP_CATEGORY && type_ ? type_.id : null;
|
type_ != null && type_.posTypeName == item.MP_CATEGORY && type_ ? type_.id : null;
|
||||||
|
|
|
||||||
|
|
@ -259,9 +259,6 @@ export class ReportController extends Controller {
|
||||||
tenureTypeCondition = "registryOfficer.Years BETWEEN :tenureMin AND :tenureMax"; //xxxxxxxxxxxx
|
tenureTypeCondition = "registryOfficer.Years BETWEEN :tenureMin AND :tenureMax"; //xxxxxxxxxxxx
|
||||||
}
|
}
|
||||||
|
|
||||||
const sql_mode = await AppDataSource.query(
|
|
||||||
"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));",
|
|
||||||
);
|
|
||||||
const [lists, total] = await AppDataSource.getRepository(viewRegistryOfficer)
|
const [lists, total] = await AppDataSource.getRepository(viewRegistryOfficer)
|
||||||
.createQueryBuilder("registryOfficer")
|
.createQueryBuilder("registryOfficer")
|
||||||
.where(nodeCondition, {
|
.where(nodeCondition, {
|
||||||
|
|
|
||||||
|
|
@ -52,4 +52,18 @@ export class HR_EDUCATION {
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
EDUCATION_SEQ: string;
|
EDUCATION_SEQ: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
FUND_COURSE_CODE: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
MAJOR_CODE: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
35
src/entities/HR_FUND_COURSE_CODE.ts
Normal file
35
src/entities/HR_FUND_COURSE_CODE.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
|
||||||
|
@Entity("HR_FUND_COURSE_CODE")
|
||||||
|
export class HR_FUND_COURSE_CODE {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id!: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
FUND_COURSE_CODE: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
FUND_COURSE_NAME: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
LEVEL_SEQ: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
refId: string;
|
||||||
|
}
|
||||||
28
src/entities/HR_MAJOR_CODE.ts
Normal file
28
src/entities/HR_MAJOR_CODE.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
|
||||||
|
@Entity("HR_MAJOR_CODE")
|
||||||
|
export class HR_MAJOR_CODE {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id!: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
MAJOR_CODE: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
MAJOR_NAME: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
MAJOR_ABB_NAME: string;
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,13 @@ export class OFFICER {
|
||||||
// })
|
// })
|
||||||
// ID: string;
|
// ID: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
CIT: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
@ -130,4 +137,11 @@ export class OFFICER {
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
POS_NUM_NAME: string;
|
POS_NUM_NAME: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
ADMIN_NAME: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
65
src/entities/ProfileSalaries.ts
Normal file
65
src/entities/ProfileSalaries.ts
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { Entity, Column, Double } from "typeorm";
|
||||||
|
import { EntityBase } from "./base/Base";
|
||||||
|
|
||||||
|
@Entity("ProfileSalaries")
|
||||||
|
export class ProfileSalaries extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
Order: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
Date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
SalaryRef: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
Amount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
PositionSalaryAmount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
PosNoName: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
PositionTypeName: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
PositionLevelName: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
PositionName: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
ProfileId: string;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue