diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index 742496ff..25ef7697 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -109,12 +109,12 @@ export class ImportDataController extends Controller { let type_: any = null; let level_: any = null; const profile = new Profile(); - if (item["FLAG_RETIRE_STATUS"] != "" && item["FLAG_RETIRE_STATUS"] != null) { - continue; - } - if (item["FLAG_PERSON_TYPE"] != "1") { - continue; - } + // if (item["FLAG_RETIRE_STATUSxxxx"] != "" && item["FLAG_RETIRE_STATUSxxxx"] != null) { + // continue; + // } + // if (item["FLAG_PERSON_TYPExxxx"] != "1") { + // continue; + // } const existingProfile = await this.profileRepo.findOne({ where: { citizenId: item["ID"] }, }); @@ -122,29 +122,29 @@ export class ImportDataController extends Controller { continue; } - if (item["MP_CEE_TYPE"]) { + if (item["TYPE"]) { type_ = await this.posTypeRepo.findOne({ - where: { posTypeName: item["MP_CEE_TYPE"] }, + where: { posTypeName: item["TYPE"] }, }); } - if (item["MP_CEE_POSITION"]) { + if (item["LEVEL"]) { if (type_ == null) { level_ = await this.posLevelRepo.findOne({ where: { - posLevelName: item["MP_CEE_POSITION"], + posLevelName: item["LEVEL"], }, }); } else { level_ = await this.posLevelRepo.findOne({ where: { - posLevelName: item["MP_CEE_POSITION"], + posLevelName: item["LEVEL"], posTypeId: type_.id, }, }); } } - let dateRetire = Extension.ConvertToDateTime(item["MP_FORCE_DATE"]); + let dateRetire = Extension.ConvertToDateTime(item["BORN"]); profile.citizenId = item["ID"] == "" ? "" : item["ID"]; profile.rank = item["RANK_NAME"] == "" ? null : item["RANK_NAME"]; profile.prefix = item["RANK_NAME"] == "" ? null : item["RANK_NAME"]; @@ -157,20 +157,20 @@ export class ImportDataController extends Controller { ? null_ : Extension.ConvertToDateTime(item["BEGIN_ENTRY_DATE"]); profile.dateStart = - item["MP_FORCE_DATE"] == "" ? null_ : Extension.ConvertToDateTime(item["MP_FORCE_DATE"]); + item["BEGIN_ENTRY_DATE"] == "" + ? null_ + : Extension.ConvertToDateTime(item["BEGIN_ENTRY_DATE"]); profile.dateRetire = dateRetire == null ? null_ : calculateRetireDate(dateRetire); profile.dateRetireLaw = dateRetire == null ? null_ : calculateRetireLaw(dateRetire); profile.position = item["WORK_LINE_NAME"] == "" ? null : item["WORK_LINE_NAME"]; profile.posTypeId = - type_ != null && type_.posTypeName == item["MP_CEE_TYPE"] && type_ ? type_.id : null; + type_ != null && type_.posTypeName == item["TYPE"] && type_ ? type_.id : null; profile.posLevelId = - level_ != null && level_.posLevelName == item["MP_CEE_POSITION"] && level_ - ? level_.id - : null; + level_ != null && level_.posLevelName == item["LEVEL"] && level_ ? level_.id : null; profile.relationship = - item["MARRIAGE_STATE"] == "" ? "" : Extension.CheckRelationship(item["MARRIAGE_STATE"]); - profile.isLeave = - item["FLAG_RETIRE_STATUS"] == "" || item["FLAG_RETIRE_STATUS"] == null ? false : true; + item["สถานภาพ"] == "" ? "" : Extension.CheckRelationship(item["สถานภาพ"]); + // profile.isLeave = + // item["FLAG_RETIRE_STATUSxxxx"] == "" || item["FLAG_RETIRE_STATUSxxxx"] == null ? false : true; profile.createdUserId = request.user.sub; profile.createdFullName = request.user.name; profile.lastUpdateUserId = request.user.sub;