บรรจุ
This commit is contained in:
parent
31b8116a6f
commit
d999c8050c
3 changed files with 379 additions and 34 deletions
|
|
@ -79,6 +79,12 @@ import { ProfileAssistance } from "../entities/ProfileAssistance";
|
||||||
import { ProfileAssistanceHistory } from "../entities/ProfileAssistanceHistory";
|
import { ProfileAssistanceHistory } from "../entities/ProfileAssistanceHistory";
|
||||||
import { ProfileActposition } from "../entities/ProfileActposition";
|
import { ProfileActposition } from "../entities/ProfileActposition";
|
||||||
import { ProfileActpositionHistory } from "../entities/ProfileActpositionHistory";
|
import { ProfileActpositionHistory } from "../entities/ProfileActpositionHistory";
|
||||||
|
import { ProfileFamilyFather } from "../entities/ProfileFamilyFather";
|
||||||
|
import { ProfileFamilyFatherHistory } from "../entities/ProfileFamilyFatherHistory";
|
||||||
|
import { ProfileFamilyCouple } from "../entities/ProfileFamilyCouple";
|
||||||
|
import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory";
|
||||||
|
import { ProfileFamilyMother } from "../entities/ProfileFamilyMother";
|
||||||
|
import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHistory";
|
||||||
|
|
||||||
@Route("api/v1/org/command")
|
@Route("api/v1/org/command")
|
||||||
@Tags("Command")
|
@Tags("Command")
|
||||||
|
|
@ -122,6 +128,12 @@ export class CommandController extends Controller {
|
||||||
private assistanceHistoryRepository = AppDataSource.getRepository(ProfileAssistanceHistory);
|
private assistanceHistoryRepository = AppDataSource.getRepository(ProfileAssistanceHistory);
|
||||||
private actpositionRepository = AppDataSource.getRepository(ProfileActposition);
|
private actpositionRepository = AppDataSource.getRepository(ProfileActposition);
|
||||||
private actpositionHistoryRepository = AppDataSource.getRepository(ProfileActpositionHistory);
|
private actpositionHistoryRepository = AppDataSource.getRepository(ProfileActpositionHistory);
|
||||||
|
private profileFamilyCoupleRepo = AppDataSource.getRepository(ProfileFamilyCouple);
|
||||||
|
private profileFamilyCoupleHistoryRepo = AppDataSource.getRepository(ProfileFamilyCoupleHistory);
|
||||||
|
private profileFamilyMotherRepo = AppDataSource.getRepository(ProfileFamilyMother);
|
||||||
|
private profileFamilyMotherHistoryRepo = AppDataSource.getRepository(ProfileFamilyMotherHistory);
|
||||||
|
private profileFamilyFatherRepo = AppDataSource.getRepository(ProfileFamilyFather);
|
||||||
|
private profileFamilyFatherHistoryRepo = AppDataSource.getRepository(ProfileFamilyFatherHistory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API list รายการคำสั่ง
|
* API list รายการคำสั่ง
|
||||||
|
|
@ -2121,7 +2133,7 @@ export class CommandController extends Controller {
|
||||||
})
|
})
|
||||||
.then(async (res) => {})
|
.then(async (res) => {})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
let order =
|
let order =
|
||||||
command.commandRecives == null || command.commandRecives.length <= 0
|
command.commandRecives == null || command.commandRecives.length <= 0
|
||||||
? 0
|
? 0
|
||||||
: command.commandRecives[0].order;
|
: command.commandRecives[0].order;
|
||||||
|
|
@ -2160,8 +2172,7 @@ export class CommandController extends Controller {
|
||||||
commandRecive.amountSpecial =
|
commandRecive.amountSpecial =
|
||||||
item.amountSpecial ?? (salaryData ? salaryData.amountSpecial : _setZero);
|
item.amountSpecial ?? (salaryData ? salaryData.amountSpecial : _setZero);
|
||||||
commandRecive.positionSalaryAmount =
|
commandRecive.positionSalaryAmount =
|
||||||
item.positionSalaryAmount ??
|
item.positionSalaryAmount ?? (salaryData ? salaryData.positionSalaryAmount : _setZero);
|
||||||
(salaryData ? salaryData.positionSalaryAmount : _setZero);
|
|
||||||
commandRecive.mouthSalaryAmount =
|
commandRecive.mouthSalaryAmount =
|
||||||
item.mouthSalaryAmount ?? (salaryData ? salaryData.mouthSalaryAmount : _setZero);
|
item.mouthSalaryAmount ?? (salaryData ? salaryData.mouthSalaryAmount : _setZero);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2171,8 +2182,7 @@ export class CommandController extends Controller {
|
||||||
commandRecive.mouthSalaryAmount = _null;
|
commandRecive.mouthSalaryAmount = _null;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandRecive.remarkVertical =
|
commandRecive.remarkVertical = item.remarkVertical == null ? _null : item.remarkVertical;
|
||||||
item.remarkVertical == null ? _null : item.remarkVertical;
|
|
||||||
commandRecive.remarkHorizontal =
|
commandRecive.remarkHorizontal =
|
||||||
item.remarkHorizontal == null ? _null : item.remarkHorizontal;
|
item.remarkHorizontal == null ? _null : item.remarkHorizontal;
|
||||||
commandRecive.order = order;
|
commandRecive.order = order;
|
||||||
|
|
@ -3288,7 +3298,17 @@ export class CommandController extends Controller {
|
||||||
const checkUser = await getUserByUsername(profile.citizenId);
|
const checkUser = await getUserByUsername(profile.citizenId);
|
||||||
//ถ้ายังไม่มี user keycloak ให้สร้างใหม่
|
//ถ้ายังไม่มี user keycloak ให้สร้างใหม่
|
||||||
if (checkUser.length == 0) {
|
if (checkUser.length == 0) {
|
||||||
userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
|
let password = profile.citizenId;
|
||||||
|
if (profile.birthDate != null) {
|
||||||
|
const gregorianYear = profile.birthDate.getFullYear() + 543;
|
||||||
|
|
||||||
|
const formattedDate =
|
||||||
|
profile.birthDate.toISOString().slice(8, 10) +
|
||||||
|
profile.birthDate.toISOString().slice(5, 7) +
|
||||||
|
gregorianYear;
|
||||||
|
password = formattedDate;
|
||||||
|
}
|
||||||
|
userKeycloakId = await createUser(profile.citizenId, password, {
|
||||||
firstName: profile.firstName,
|
firstName: profile.firstName,
|
||||||
lastName: profile.lastName,
|
lastName: profile.lastName,
|
||||||
});
|
});
|
||||||
|
|
@ -4746,6 +4766,28 @@ export class CommandController extends Controller {
|
||||||
posmasterId: string;
|
posmasterId: string;
|
||||||
positionId: string;
|
positionId: string;
|
||||||
} | null;
|
} | null;
|
||||||
|
bodyMarry?: {
|
||||||
|
marry?: boolean | null;
|
||||||
|
marryPrefix?: string | null;
|
||||||
|
marryFirstName?: string | null;
|
||||||
|
marryLastName?: string | null;
|
||||||
|
marryOccupation?: string | null;
|
||||||
|
marryNationality?: string | null;
|
||||||
|
} | null;
|
||||||
|
bodyFather?: {
|
||||||
|
fatherPrefix?: string | null;
|
||||||
|
fatherFirstName?: string | null;
|
||||||
|
fatherLastName?: string | null;
|
||||||
|
fatherOccupation?: string | null;
|
||||||
|
fatherNationality?: string | null;
|
||||||
|
} | null;
|
||||||
|
bodyMother?: {
|
||||||
|
motherPrefix?: string | null;
|
||||||
|
motherFirstName?: string | null;
|
||||||
|
motherLastName?: string | null;
|
||||||
|
motherOccupation?: string | null;
|
||||||
|
motherNationality?: string | null;
|
||||||
|
} | null;
|
||||||
}[];
|
}[];
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
|
@ -4814,14 +4856,20 @@ export class CommandController extends Controller {
|
||||||
let result: any;
|
let result: any;
|
||||||
const checkUser = await getUserByUsername(item.bodyProfile.citizenId);
|
const checkUser = await getUserByUsername(item.bodyProfile.citizenId);
|
||||||
if (checkUser.length == 0) {
|
if (checkUser.length == 0) {
|
||||||
userKeycloakId = await createUser(
|
let password = item.bodyProfile.citizenId;
|
||||||
item.bodyProfile.citizenId,
|
if (item.bodyProfile.birthDate != null) {
|
||||||
item.bodyProfile.citizenId,
|
const gregorianYear = item.bodyProfile.birthDate.getFullYear() + 543;
|
||||||
{
|
|
||||||
firstName: item.bodyProfile.firstName,
|
const formattedDate =
|
||||||
lastName: item.bodyProfile.lastName,
|
item.bodyProfile.birthDate.toISOString().slice(8, 10) +
|
||||||
},
|
item.bodyProfile.birthDate.toISOString().slice(5, 7) +
|
||||||
);
|
gregorianYear;
|
||||||
|
password = formattedDate;
|
||||||
|
}
|
||||||
|
userKeycloakId = await createUser(item.bodyProfile.citizenId, password, {
|
||||||
|
firstName: item.bodyProfile.firstName,
|
||||||
|
lastName: item.bodyProfile.lastName,
|
||||||
|
});
|
||||||
result = await addUserRoles(
|
result = await addUserRoles(
|
||||||
userKeycloakId,
|
userKeycloakId,
|
||||||
list
|
list
|
||||||
|
|
@ -4967,6 +5015,71 @@ export class CommandController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FamilyCouple
|
||||||
|
if (item.bodyMarry != null) {
|
||||||
|
const profileCouple = new ProfileFamilyCouple();
|
||||||
|
const data = {
|
||||||
|
profileId: profile.id,
|
||||||
|
couple: item.bodyMarry.marry,
|
||||||
|
couplePrefix: item.bodyMarry.marryPrefix,
|
||||||
|
coupleFirstName: item.bodyMarry.marryFirstName,
|
||||||
|
coupleLastName: item.bodyMarry.marryLastName,
|
||||||
|
coupleCareer: item.bodyMarry.marryOccupation,
|
||||||
|
coupleLive: true,
|
||||||
|
};
|
||||||
|
Object.assign(profileCouple, { ...data, ...meta });
|
||||||
|
const coupleHistory = new ProfileFamilyCoupleHistory();
|
||||||
|
Object.assign(coupleHistory, { ...profileCouple, id: undefined });
|
||||||
|
profileCouple.profileId = profile.id;
|
||||||
|
await this.profileFamilyCoupleRepo.save(profileCouple, { data: req });
|
||||||
|
setLogDataDiff(req, { before, after: profileCouple });
|
||||||
|
coupleHistory.profileFamilyCoupleId = profileCouple.id;
|
||||||
|
await this.profileFamilyCoupleHistoryRepo.save(coupleHistory, { data: req });
|
||||||
|
}
|
||||||
|
|
||||||
|
//FamilyFather
|
||||||
|
if (item.bodyFather != null) {
|
||||||
|
const profileFather = new ProfileFamilyFather();
|
||||||
|
const data = {
|
||||||
|
profileId: profile.id,
|
||||||
|
fatherPrefix: item.bodyFather.fatherPrefix,
|
||||||
|
fatherFirstName: item.bodyFather.fatherFirstName,
|
||||||
|
fatherLastName: item.bodyFather.fatherLastName,
|
||||||
|
fatherCareer: item.bodyFather.fatherOccupation,
|
||||||
|
fatherLive: true,
|
||||||
|
};
|
||||||
|
Object.assign(profileFather, { ...data, ...meta });
|
||||||
|
const fatherHistory = new ProfileFamilyFatherHistory();
|
||||||
|
Object.assign(fatherHistory, { ...profileFather, id: undefined });
|
||||||
|
profileFather.profileId = profile.id;
|
||||||
|
await this.profileFamilyFatherRepo.save(profileFather, { data: req });
|
||||||
|
setLogDataDiff(req, { before, after: profileFather });
|
||||||
|
fatherHistory.profileFamilyFatherId = profileFather.id;
|
||||||
|
await this.profileFamilyFatherHistoryRepo.save(fatherHistory, { data: req });
|
||||||
|
}
|
||||||
|
|
||||||
|
//FamilyMother
|
||||||
|
if (item.bodyMother != null) {
|
||||||
|
const profileMother = new ProfileFamilyMother();
|
||||||
|
const data = {
|
||||||
|
profileId: profile.id,
|
||||||
|
motherPrefix: item.bodyMother.motherPrefix,
|
||||||
|
motherFirstName: item.bodyMother.motherFirstName,
|
||||||
|
motherLastName: item.bodyMother.motherLastName,
|
||||||
|
motherCareer: item.bodyMother.motherOccupation,
|
||||||
|
motherLive: true,
|
||||||
|
};
|
||||||
|
Object.assign(profileMother, { ...data, ...meta });
|
||||||
|
const motherHistory = new ProfileFamilyMotherHistory();
|
||||||
|
Object.assign(motherHistory, { ...profileMother, id: undefined });
|
||||||
|
profileMother.profileId = profile.id;
|
||||||
|
await this.profileFamilyMotherRepo.save(profileMother, { data: req });
|
||||||
|
setLogDataDiff(req, { before, after: profileMother });
|
||||||
|
motherHistory.profileFamilyMotherId = profileMother.id;
|
||||||
|
await this.profileFamilyMotherHistoryRepo.save(motherHistory, { data: req });
|
||||||
|
}
|
||||||
|
|
||||||
//Salary
|
//Salary
|
||||||
if (item.bodySalarys && item.bodySalarys != null) {
|
if (item.bodySalarys && item.bodySalarys != null) {
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
|
|
@ -5293,7 +5406,17 @@ export class CommandController extends Controller {
|
||||||
// Create Keycloak
|
// Create Keycloak
|
||||||
const checkUser = await getUserByUsername(profile.citizenId);
|
const checkUser = await getUserByUsername(profile.citizenId);
|
||||||
if (checkUser.length == 0) {
|
if (checkUser.length == 0) {
|
||||||
const userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
|
let password = profile.citizenId;
|
||||||
|
if (profile.birthDate != null) {
|
||||||
|
const gregorianYear = profile.birthDate.getFullYear() + 543;
|
||||||
|
|
||||||
|
const formattedDate =
|
||||||
|
profile.birthDate.toISOString().slice(8, 10) +
|
||||||
|
profile.birthDate.toISOString().slice(5, 7) +
|
||||||
|
gregorianYear;
|
||||||
|
password = formattedDate;
|
||||||
|
}
|
||||||
|
const userKeycloakId = await createUser(profile.citizenId, password, {
|
||||||
firstName: profile.firstName,
|
firstName: profile.firstName,
|
||||||
lastName: profile.lastName,
|
lastName: profile.lastName,
|
||||||
// email: profile.email,
|
// email: profile.email,
|
||||||
|
|
|
||||||
|
|
@ -2655,4 +2655,241 @@ export class ImportDataController extends Controller {
|
||||||
}
|
}
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OrgRank(value: string) {
|
||||||
|
switch (value.trim().toUpperCase()) {
|
||||||
|
case "DEPARTMENT":
|
||||||
|
return "หน่วยงาน";
|
||||||
|
case "OFFICE":
|
||||||
|
return "ส่วนราชการระดับกอง/สำนักงาน หรือเทียบเท่า";
|
||||||
|
case "DIVISION":
|
||||||
|
return "ส่วนราชการระดับส่วน/กลุ่มภารกิจ";
|
||||||
|
case "SECTION":
|
||||||
|
return "ส่วนราชการระดับฝ่าย/กลุ่มงาน หรือเทียบเท่า";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OrgRankSub(value: string) {
|
||||||
|
switch (value.trim().toUpperCase()) {
|
||||||
|
case "BUREAU":
|
||||||
|
return "สำนัก";
|
||||||
|
case "OFFICE":
|
||||||
|
return "สำนักงาน";
|
||||||
|
case "DISTRICT":
|
||||||
|
return "สำนักงานเขต";
|
||||||
|
case "DIVISION":
|
||||||
|
return "กอง";
|
||||||
|
case "INSTITUTION":
|
||||||
|
return "สถาบัน";
|
||||||
|
case "HOSPITAL":
|
||||||
|
return "โรงพยาบาล";
|
||||||
|
case "CENTER":
|
||||||
|
return "ศูนย์";
|
||||||
|
case "MEDICAL":
|
||||||
|
return "ศูนย์บริการการแพทย์";
|
||||||
|
case "HEALTHMAJOR":
|
||||||
|
return "ศูนย์บริการสาธารณสุข";
|
||||||
|
case "UNIT":
|
||||||
|
return "หน่วย";
|
||||||
|
case "SECTION":
|
||||||
|
return "ส่วน";
|
||||||
|
case "FACTION":
|
||||||
|
return "ฝ่าย";
|
||||||
|
case "GROUPWORK":
|
||||||
|
return "กลุ่มงาน";
|
||||||
|
case "HEALTHBRANCH":
|
||||||
|
return "ศูนย์บริการสาธารณสุขสาขา";
|
||||||
|
case "TRAINING":
|
||||||
|
return "ศูนย์ฝึกอาชีพ";
|
||||||
|
case "SCHOOL":
|
||||||
|
return "โรงเรียนฝึกอาชีพ";
|
||||||
|
case "ELDERLY":
|
||||||
|
return "บ้านพักผู้สูงอายุ";
|
||||||
|
case "PARK":
|
||||||
|
return "สวนสาธารณะ";
|
||||||
|
case "FIRESTATION":
|
||||||
|
return "สถานีดับเพลิง";
|
||||||
|
case "WORK":
|
||||||
|
return "งาน";
|
||||||
|
case "PRIMARYSCHOOL":
|
||||||
|
return "โรงเรียนประถมศึกษา";
|
||||||
|
case "SECONDARYSCHOOL":
|
||||||
|
return "โรงเรียนมัธยมศึกษา";
|
||||||
|
case "MISSION":
|
||||||
|
return "กลุ่มภารกิจ";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @summary Import Org
|
||||||
|
*/
|
||||||
|
@Post("ExportOrg")
|
||||||
|
async ExportOrg(@Request() request: { user: Record<string, any> }) {
|
||||||
|
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: false, orgRevisionIsDraft: true },
|
||||||
|
// where: { id: "30e594c9-a65b-485e-a4c5-71aa497e6b8a" },
|
||||||
|
});
|
||||||
|
if (orgRevision == null) return new HttpSuccess();
|
||||||
|
//create root
|
||||||
|
const orgRaw = await this.orgRootRepo.find({
|
||||||
|
where: { orgRevisionId: orgRevision.id },
|
||||||
|
order: {
|
||||||
|
orgRootOrder: "ASC",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
let order = 1;
|
||||||
|
let result = [];
|
||||||
|
for await (const item of orgRaw) {
|
||||||
|
console.log(item.orgRootOrder);
|
||||||
|
const data = {
|
||||||
|
ORDER: order,
|
||||||
|
HRMS_DEP_CODE: "",
|
||||||
|
HRMS_DIV_CODE: "",
|
||||||
|
DEPARTMENT_CODE: item.DEPARTMENT_CODE,
|
||||||
|
DIVISION_CODE: item.DIVISION_CODE,
|
||||||
|
SECTION_CODE: item.SECTION_CODE,
|
||||||
|
JOB_CODE: item.JOB_CODE,
|
||||||
|
orgRoot: item.orgRootName,
|
||||||
|
orgChild1: "",
|
||||||
|
orgChild2: "",
|
||||||
|
orgChild3: "",
|
||||||
|
orgChild4: "",
|
||||||
|
orgShortname: item.orgRootShortName,
|
||||||
|
orgRank: this.OrgRank(item.orgRootRank),
|
||||||
|
orgSubRank: this.OrgRankSub(item.orgRootRankSub),
|
||||||
|
};
|
||||||
|
await result.push(data);
|
||||||
|
order++;
|
||||||
|
const org1Raw = await this.orgChild1Repo.find({
|
||||||
|
where: { orgRevisionId: orgRevision.id, orgRootId: item.id },
|
||||||
|
order: {
|
||||||
|
orgChild1Order: "ASC",
|
||||||
|
},
|
||||||
|
relations: ["orgRoot"],
|
||||||
|
});
|
||||||
|
for await (const item1 of org1Raw) {
|
||||||
|
const data1 = {
|
||||||
|
ORDER: order,
|
||||||
|
HRMS_DEP_CODE: "",
|
||||||
|
HRMS_DIV_CODE: "",
|
||||||
|
DEPARTMENT_CODE: item1.DEPARTMENT_CODE,
|
||||||
|
DIVISION_CODE: item1.DIVISION_CODE,
|
||||||
|
SECTION_CODE: item1.SECTION_CODE,
|
||||||
|
JOB_CODE: item1.JOB_CODE,
|
||||||
|
orgRoot: item1.orgRoot.orgRootName,
|
||||||
|
orgChild1: item1.orgChild1Name,
|
||||||
|
orgChild2: "",
|
||||||
|
orgChild3: "",
|
||||||
|
orgChild4: "",
|
||||||
|
orgShortname: item1.orgChild1ShortName,
|
||||||
|
orgRank: this.OrgRank(item1.orgChild1Rank),
|
||||||
|
orgSubRank: this.OrgRankSub(item1.orgChild1RankSub),
|
||||||
|
};
|
||||||
|
await result.push(data1);
|
||||||
|
order++;
|
||||||
|
const org2Raw = await this.orgChild2Repo.find({
|
||||||
|
where: { orgRevisionId: orgRevision.id, orgRootId: item.id, orgChild1Id: item1.id },
|
||||||
|
order: {
|
||||||
|
orgChild2Order: "ASC",
|
||||||
|
},
|
||||||
|
relations: ["orgRoot", "orgChild1"],
|
||||||
|
});
|
||||||
|
for await (const item2 of org2Raw) {
|
||||||
|
const data2 = {
|
||||||
|
ORDER: order,
|
||||||
|
HRMS_DEP_CODE: "",
|
||||||
|
HRMS_DIV_CODE: "",
|
||||||
|
DEPARTMENT_CODE: item2.DEPARTMENT_CODE,
|
||||||
|
DIVISION_CODE: item2.DIVISION_CODE,
|
||||||
|
SECTION_CODE: item2.SECTION_CODE,
|
||||||
|
JOB_CODE: item2.JOB_CODE,
|
||||||
|
orgRoot: item2.orgRoot.orgRootName,
|
||||||
|
orgChild1: item2.orgChild1.orgChild1Name,
|
||||||
|
orgChild2: item2.orgChild2Name,
|
||||||
|
orgChild3: "",
|
||||||
|
orgChild4: "",
|
||||||
|
orgShortname: item2.orgChild2ShortName,
|
||||||
|
orgRank: this.OrgRank(item2.orgChild2Rank),
|
||||||
|
orgSubRank: this.OrgRankSub(item2.orgChild2RankSub),
|
||||||
|
};
|
||||||
|
await result.push(data2);
|
||||||
|
order++;
|
||||||
|
const org3Raw = await this.orgChild3Repo.find({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRevision.id,
|
||||||
|
orgRootId: item.id,
|
||||||
|
orgChild1Id: item1.id,
|
||||||
|
orgChild2Id: item2.id,
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
orgChild3Order: "ASC",
|
||||||
|
},
|
||||||
|
relations: ["orgRoot", "orgChild1", "orgChild2"],
|
||||||
|
});
|
||||||
|
for await (const item3 of org3Raw) {
|
||||||
|
const data3 = {
|
||||||
|
ORDER: order,
|
||||||
|
HRMS_DEP_CODE: "",
|
||||||
|
HRMS_DIV_CODE: "",
|
||||||
|
DEPARTMENT_CODE: item3.DEPARTMENT_CODE,
|
||||||
|
DIVISION_CODE: item3.DIVISION_CODE,
|
||||||
|
SECTION_CODE: item3.SECTION_CODE,
|
||||||
|
JOB_CODE: item3.JOB_CODE,
|
||||||
|
orgRoot: item3.orgRoot.orgRootName,
|
||||||
|
orgChild1: item3.orgChild1.orgChild1Name,
|
||||||
|
orgChild2: item3.orgChild2.orgChild2Name,
|
||||||
|
orgChild3: item3.orgChild3Name,
|
||||||
|
orgChild4: "",
|
||||||
|
orgShortname: item3.orgChild3ShortName,
|
||||||
|
orgRank: this.OrgRank(item3.orgChild3Rank),
|
||||||
|
orgSubRank: this.OrgRankSub(item3.orgChild3RankSub),
|
||||||
|
};
|
||||||
|
await result.push(data3);
|
||||||
|
order++;
|
||||||
|
const org4Raw = await this.orgChild4Repo.find({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: orgRevision.id,
|
||||||
|
orgRootId: item.id,
|
||||||
|
orgChild1Id: item1.id,
|
||||||
|
orgChild2Id: item2.id,
|
||||||
|
orgChild3Id: item3.id,
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
orgChild4Order: "ASC",
|
||||||
|
},
|
||||||
|
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3"],
|
||||||
|
});
|
||||||
|
for await (const item4 of org4Raw) {
|
||||||
|
const data4 = {
|
||||||
|
ORDER: order,
|
||||||
|
HRMS_DEP_CODE: "",
|
||||||
|
HRMS_DIV_CODE: "",
|
||||||
|
DEPARTMENT_CODE: item4.DEPARTMENT_CODE,
|
||||||
|
DIVISION_CODE: item4.DIVISION_CODE,
|
||||||
|
SECTION_CODE: item4.SECTION_CODE,
|
||||||
|
JOB_CODE: item4.JOB_CODE,
|
||||||
|
orgRoot: item4.orgRoot.orgRootName,
|
||||||
|
orgChild1: item4.orgChild1.orgChild1Name,
|
||||||
|
orgChild2: item4.orgChild2.orgChild2Name,
|
||||||
|
orgChild3: item4.orgChild3.orgChild3Name,
|
||||||
|
orgChild4: item4.orgChild4Name,
|
||||||
|
orgShortname: item4.orgChild4ShortName,
|
||||||
|
orgRank: this.OrgRank(item4.orgChild4Rank),
|
||||||
|
orgSubRank: this.OrgRankSub(item4.orgChild4RankSub),
|
||||||
|
};
|
||||||
|
await result.push(data4);
|
||||||
|
order++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new HttpSuccess({
|
||||||
|
template: "exportRawOrg",
|
||||||
|
reportName: "exportRawOrg",
|
||||||
|
data: { data: result },
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -235,22 +235,7 @@ export class ProfileSalaryController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
// commandCode: In(["5", "6", "7"])
|
// commandCode: In(["5", "6", "7"])
|
||||||
commandCode: In([
|
commandCode: In(["5", "6", "7"]),
|
||||||
"0",
|
|
||||||
"9",
|
|
||||||
"1",
|
|
||||||
"2",
|
|
||||||
"3",
|
|
||||||
"4",
|
|
||||||
"8",
|
|
||||||
"10",
|
|
||||||
"11",
|
|
||||||
"12",
|
|
||||||
"13",
|
|
||||||
"14",
|
|
||||||
"15",
|
|
||||||
"16",
|
|
||||||
]),
|
|
||||||
},
|
},
|
||||||
order: { order: "ASC" },
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue