This commit is contained in:
Adisak 2026-05-27 14:24:32 +07:00
parent 59c5cfb9bf
commit fa2d922fc3

View file

@ -7006,7 +7006,7 @@ export class CommandController extends Controller {
profile.currentSubDistrictId = currentSubDistrictId ? currentSubDistrictId.id : _null; profile.currentSubDistrictId = currentSubDistrictId ? currentSubDistrictId.id : _null;
profile.currentZipCode = item.bodyProfile.currentZipCode; profile.currentZipCode = item.bodyProfile.currentZipCode;
profile.email = item.bodyProfile.email; profile.email = item.bodyProfile.email;
profile.dateStart = item.bodyProfile.dateStart; profile.dateStart = item.bodySalarys?.commandDateAffect ?? item.bodyProfile.dateStart;
profile.amount = item.bodyProfile.amount ?? null; profile.amount = item.bodyProfile.amount ?? null;
profile.amountSpecial = item.bodyProfile.amountSpecial ?? null; profile.amountSpecial = item.bodyProfile.amountSpecial ?? null;
profile.isProbation = item.bodyProfile.isProbation; profile.isProbation = item.bodyProfile.isProbation;
@ -7076,7 +7076,7 @@ export class CommandController extends Controller {
profile.currentSubDistrictId = currentSubDistrictId ? currentSubDistrictId.id : _null; profile.currentSubDistrictId = currentSubDistrictId ? currentSubDistrictId.id : _null;
profile.currentZipCode = item.bodyProfile.currentZipCode; profile.currentZipCode = item.bodyProfile.currentZipCode;
profile.email = item.bodyProfile.email; profile.email = item.bodyProfile.email;
profile.dateStart = item.bodyProfile.dateStart; profile.dateStart = item.bodySalarys?.commandDateAffect ?? item.bodyProfile.dateStart;
profile.amount = item.bodyProfile.amount ?? null; profile.amount = item.bodyProfile.amount ?? null;
profile.amountSpecial = item.bodyProfile.amountSpecial ?? null; profile.amountSpecial = item.bodyProfile.amountSpecial ?? null;
profile.isProbation = item.bodyProfile.isProbation; profile.isProbation = item.bodyProfile.isProbation;
@ -7128,7 +7128,7 @@ export class CommandController extends Controller {
profile.email = item.bodyProfile.email; profile.email = item.bodyProfile.email;
profile.telephoneNumber = item.bodyProfile.telephoneNumber; profile.telephoneNumber = item.bodyProfile.telephoneNumber;
profile.phone = item.bodyProfile.phone; profile.phone = item.bodyProfile.phone;
profile.dateStart = item.bodyProfile.dateStart; profile.dateStart = item.bodySalarys?.commandDateAffect ?? item.bodyProfile.dateStart;
profile.amount = item.bodyProfile.amount ?? null; profile.amount = item.bodyProfile.amount ?? null;
profile.amountSpecial = item.bodyProfile.amountSpecial ?? null; profile.amountSpecial = item.bodyProfile.amountSpecial ?? null;
profile.leaveCommandId = _null; profile.leaveCommandId = _null;
@ -7578,6 +7578,15 @@ export class CommandController extends Controller {
// profile.dateStart = new Date(); // profile.dateStart = new Date();
} }
await this.positionRepository.save(positionNew, { data: req }); await this.positionRepository.save(positionNew, { data: req });
} else if (!posMaster.isSit) {
// fallback: ตำแหน่งในโครงสร้างถูกแก้ไข ใช้ข้อมูลตำแหน่งที่สมัครสอบมา
console.log("[Excexute/CreateOfficerProfile] positionNew is null, using bodyPosition data as fallback");
profile.position = item.bodyPosition.positionName ?? null;
profile.posTypeId = item.bodyPosition.posTypeId ?? null;
profile.posLevelId = item.bodyPosition.posLevelId ?? null;
profile.positionField = item.bodyPosition.positionField ?? null;
profile.positionArea = item.bodyPosition.positionArea ?? null;
profile.positionExecutiveField = item.bodyPosition.positionExecutiveField ?? null;
} }
await this.profileRepository.save(profile, { data: req }); await this.profileRepository.save(profile, { data: req });
setLogDataDiff(req, { before, after: profile }); setLogDataDiff(req, { before, after: profile });