แก้ import data

This commit is contained in:
Kittapath 2024-08-05 20:58:44 +07:00
parent 13a91fcb90
commit 813fc68221
2 changed files with 79 additions and 12 deletions

View file

@ -315,7 +315,7 @@ export class ImportDataController extends Controller {
rowCount++;
const profileSalary = new ProfileSalary();
profileSalary.date =
item.MP_POS_DATE == "" ? null_ : Extension.ConvertToDateTime(item.MP_POS_DATE);
item.MP_POS_DATE == "" ? null_ : Extension.ConvertToDateTimeV2(item.MP_POS_DATE);
const SALARY: any =
item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY);
profileSalary.amount = SALARY;
@ -407,7 +407,7 @@ export class ImportDataController extends Controller {
const profileSalary = new ProfileSalary();
profileSalary.date =
item.MP_POS_DATE == "" ? null_ : Extension.ConvertToDateTime(item.MP_POS_DATE);
item.MP_POS_DATE == "" ? null_ : Extension.ConvertToDateTimeV2(item.MP_POS_DATE);
const SALARY: any =
item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY);
profileSalary.amount = SALARY;
@ -524,7 +524,16 @@ export class ImportDataController extends Controller {
profileCouple.coupleFirstName = existingProfile.SPOUSE_FNAME;
profileCouple.coupleLastName = existingProfile.SPOUSE_LNAME;
profileCouple.coupleCitizenId = existingProfile.SPOUSE_ID;
profileCouple.relationship = existingProfile.MARRIAGE_STATE;
profileCouple.relationship =
existingProfile.MARRIAGE_STATE == "1"
? "โสด"
: existingProfile.MARRIAGE_STATE == "2"
? "สมรส"
: existingProfile.MARRIAGE_STATE == "3"
? "หย่าร้าง"
: existingProfile.MARRIAGE_STATE == "4"
? "หม้าย"
: "-";
// profileCouple.coupleLive = existingProfile.LIFE_SPOUSE;
profileCouple.createdUserId = request.user.sub;
profileCouple.createdFullName = request.user.name;
@ -639,7 +648,16 @@ export class ImportDataController extends Controller {
profileCouple.coupleFirstName = existingProfile.SPOUSE_FNAME;
profileCouple.coupleLastName = existingProfile.SPOUSE_LNAME;
profileCouple.coupleCitizenId = existingProfile.SPOUSE_ID;
profileCouple.relationship = existingProfile.MARRIAGE_STATE;
profileCouple.relationship =
existingProfile.MARRIAGE_STATE == "1"
? "โสด"
: existingProfile.MARRIAGE_STATE == "2"
? "สมรส"
: existingProfile.MARRIAGE_STATE == "3"
? "หย่าร้าง"
: existingProfile.MARRIAGE_STATE == "4"
? "หม้าย"
: "-";
// profileCouple.coupleLive = existingProfile.LIFE_SPOUSE;
profileCouple.createdUserId = request.user.sub;
profileCouple.createdFullName = request.user.name;
@ -750,14 +768,14 @@ export class ImportDataController extends Controller {
});
let startDate = item.START_EDUCATION_YEAR
? Extension.ConvertToDateTime(item.START_EDUCATION_YEAR)
? Extension.ConvertToDateTimeV2(item.START_EDUCATION_YEAR)
: null_;
startDate = startDate ? new Date(startDate, 0, 1) : null_;
// startDate = startDate ? new Date(startDate, 0, 1) : null_;
let endDate = item.EDUCATION_YEAR
? Extension.ConvertToDateTime(item.EDUCATION_YEAR)
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
: null_;
endDate = endDate ? new Date(endDate, 0, 1) : null_;
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
education.profileId = _item.id;
education.degree = educationCode ? educationCode.EDUCATION_NAME : "";
@ -824,14 +842,14 @@ export class ImportDataController extends Controller {
});
let startDate = item.START_EDUCATION_YEAR
? Extension.ConvertToDateTime(item.START_EDUCATION_YEAR)
? Extension.ConvertToDateTimeV2(item.START_EDUCATION_YEAR)
: null_;
startDate = startDate ? new Date(startDate, 0, 1) : null_;
// startDate = startDate ? new Date(startDate, 0, 1) : null_;
let endDate = item.EDUCATION_YEAR
? Extension.ConvertToDateTime(item.EDUCATION_YEAR)
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
: null_;
endDate = endDate ? new Date(endDate, 0, 1) : null_;
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
education.profileEmployeeId = _item.id;
education.degree = educationCode ? educationCode.EDUCATION_NAME : "";