import edu mis

This commit is contained in:
kittapath 2025-03-11 10:03:55 +07:00
parent 7d572b18d2
commit cfb5038357
2 changed files with 46 additions and 9 deletions

View file

@ -1242,14 +1242,15 @@ export class ImportDataController extends Controller {
for (const _item of profiles) { for (const _item of profiles) {
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",
], // ],
order: { EDUCATION_SEQ: "ASC" },
}); });
const educationLevel = await this.profileEducationRepo.findOne({ const educationLevel = await this.profileEducationRepo.findOne({
@ -1281,7 +1282,36 @@ export class ImportDataController extends Controller {
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR) ? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
: _null; : _null;
// endDate = endDate ? new Date(endDate, 0, 1) : _null; // endDate = endDate ? new Date(endDate, 0, 1) : _null;
if (item.FLAG_EDUCATION == "1") {
const checkData = await this.HR_EDUCATIONRepo.find({
where: { CIT: _item.citizenId, FLAG_EDUCATION: "1" },
order: { EDUCATION_SEQ: "DESC" },
});
if ((checkData.length > 1 && checkData[0].id == item.id) || checkData.length == 1) {
education.isEducation = true;
const findIsHigh = await this.HR_EDUCATIONRepo.findOne({
where: { CIT: _item.citizenId, FLAG_EDUCATION: "3" },
});
if (findIsHigh == null) {
education.isHigh = true;
}
}
} else if (item.FLAG_EDUCATION == "2") {
} else if (item.FLAG_EDUCATION == "3") {
const checkData = await this.HR_EDUCATIONRepo.find({
where: { CIT: _item.citizenId, FLAG_EDUCATION: "3" },
order: { EDUCATION_SEQ: "DESC" },
});
if ((checkData.length > 1 && checkData[0].id == item.id) || checkData.length == 1) {
education.isHigh = true;
const findIsEducation = await this.HR_EDUCATIONRepo.findOne({
where: { CIT: _item.citizenId, FLAG_EDUCATION: "1" },
});
if (findIsEducation == null) {
education.isEducation = true;
}
}
}
education.level = educationLevel == null ? 1 : educationLevel.level + 1; education.level = educationLevel == null ? 1 : educationLevel.level + 1;
education.profileId = _item.id; education.profileId = _item.id;
education.degree = educationCode ? educationCode.EDUCATION_NAME : _null; education.degree = educationCode ? educationCode.EDUCATION_NAME : _null;

View file

@ -66,4 +66,11 @@ export class HR_EDUCATION {
default: null, default: null,
}) })
MAJOR_CODE: string; MAJOR_CODE: string;
@Column({
nullable: true,
type: "text",
default: null,
})
FLAG_EDUCATION: string;
} }