Merge branch 'develop'
* develop: migrate table posMaster fix bug return profile id test #2160 update search comment ออกก่อนเพราะยังไม่ได้ใช้ #2154 fix #2153 update search org old migration: add field dnaId and profileId no message
This commit is contained in:
commit
34985e847a
8 changed files with 728 additions and 271 deletions
|
|
@ -18,7 +18,7 @@ import HttpStatus from "../interfaces/http-status";
|
|||
import HttpError from "../interfaces/http-error";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { And, Between, Brackets, In, IsNull, Not } from "typeorm";
|
||||
import { And, Between, Brackets, In, IsNull, LessThanOrEqual, Not } from "typeorm";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
import { OrgRoot } from "../entities/OrgRoot";
|
||||
import { OrgChild1 } from "../entities/OrgChild1";
|
||||
|
|
@ -34,6 +34,7 @@ import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
|||
import { EmployeePosDict } from "../entities/EmployeePosDict";
|
||||
import { calculateRetireLaw } from "../interfaces/utils";
|
||||
import Extension from "../interfaces/extension";
|
||||
import { PosMasterHistory } from "../entities/PosMasterHistory";
|
||||
@Route("api/v1/org/dotnet")
|
||||
@Tags("Dotnet")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -53,14 +54,15 @@ export class OrganizationDotnetController extends Controller {
|
|||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||
private positionRepository = AppDataSource.getRepository(Position);
|
||||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||
private posMasterHistoryRepository = AppDataSource.getRepository(PosMasterHistory);
|
||||
private empPosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
||||
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
||||
|
||||
/**
|
||||
* ทำไว้ให้ service อื่นๆ ภายในระบบ call มาตรวจสอบเลขบัตรประจำตัวประชาชน
|
||||
* ทำไว้ให้ service อื่นๆ ภายในระบบ call มาตรวจสอบเลขบัตรประจำตัวประชาชน
|
||||
*
|
||||
* @summary API ตรวจสอบเช็คเลขบัตรประจำตัวประชาชน
|
||||
* @summary API ตรวจสอบเช็คเลขบัตรประจำตัวประชาชน
|
||||
*
|
||||
*/
|
||||
@Post("check-citizen")
|
||||
|
|
@ -70,7 +72,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
citizenId: string;
|
||||
},
|
||||
) {
|
||||
let citizen = Extension.CheckCitizen(body.citizenId)
|
||||
let citizen = Extension.CheckCitizen(body.citizenId);
|
||||
return new HttpSuccess(citizen);
|
||||
}
|
||||
|
||||
|
|
@ -996,8 +998,8 @@ export class OrganizationDotnetController extends Controller {
|
|||
|
||||
let positionLeaveName =
|
||||
profile.posType != null &&
|
||||
profile.posLevel != null &&
|
||||
(profile.posType.posTypeName == "บริหาร" || profile.posType.posTypeName == "อำนวยการ")
|
||||
profile.posLevel != null &&
|
||||
(profile.posType.posTypeName == "บริหาร" || profile.posType.posTypeName == "อำนวยการ")
|
||||
? `${profile.posType?.posTypeName ?? ""}${profile.posLevel?.posLevelName ?? ""}`
|
||||
: profile.posLevel?.posLevelName ?? null;
|
||||
const _profileCurrent = profile?.current_holders?.find(
|
||||
|
|
@ -2589,26 +2591,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
profile.current_holders.length == 0
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
|
||||
|
|
@ -2657,14 +2659,21 @@ export class OrganizationDotnetController extends Controller {
|
|||
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel?.posLevelName ?? "",
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary,
|
||||
// profileSalary: profile.profileSalary,
|
||||
profileSalary:
|
||||
profile.profileSalary?.map((x) => ({
|
||||
...x,
|
||||
date: x.commandDateAffect ?? new Date(),
|
||||
})) ?? [],
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia: profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
profileInsignia:
|
||||
profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insigniaId: x.insignia?.id ?? null,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2892,26 +2901,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
profile.current_holders.length == 0
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
return {
|
||||
|
|
@ -2962,9 +2971,15 @@ export class OrganizationDotnetController extends Controller {
|
|||
: profile.posType?.posTypeShortName + " ") + (profile.posLevel?.posLevelName ?? ""),
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary,
|
||||
profileInsignia: profile.profileInsignias.map((x) => {
|
||||
return { ...x, insignia: x.insignia.name };
|
||||
}),
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia:
|
||||
profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insigniaId: x.insignia?.id ?? null,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -3107,26 +3122,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
profile.current_holders.length == 0
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${profile.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
return {
|
||||
|
|
@ -3176,12 +3191,23 @@ export class OrganizationDotnetController extends Controller {
|
|||
? ""
|
||||
: profile.posType?.posTypeShortName + " ") + (profile.posLevel?.posLevelName ?? ""),
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary.map((x) => {
|
||||
return { ...x, date: x.commandDateAffect ?? new Date() };
|
||||
}),
|
||||
profileInsignia: profile.profileInsignias.map((x) => {
|
||||
return { ...x, insignia: x.insignia.name };
|
||||
}),
|
||||
// profileSalary: profile.profileSalary.map((x) => {
|
||||
// return { ...x, date: x.commandDateAffect ?? new Date() };
|
||||
// }),
|
||||
profileSalary:
|
||||
profile.profileSalary?.map((x) => ({
|
||||
...x,
|
||||
date: x.commandDateAffect ?? new Date(),
|
||||
})) ?? [],
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia:
|
||||
profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insigniaId: x.insignia?.id ?? null,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -3363,7 +3389,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
|
||||
const root =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
|
||||
|
||||
|
|
@ -3423,41 +3449,41 @@ export class OrganizationDotnetController extends Controller {
|
|||
|
||||
const posMaster =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.length == 0 ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
||||
profile.current_holders.length == 0 ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
||||
|
||||
const root =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot == null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot;
|
||||
|
||||
const child1 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild1;
|
||||
|
||||
const child2 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild2;
|
||||
|
||||
const child3 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild3;
|
||||
|
||||
const child4 =
|
||||
profile.current_holders == null ||
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4 ==
|
||||
null
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4;
|
||||
|
|
@ -3596,30 +3622,30 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
||||
?.orgRootName;
|
||||
?.orgRootName;
|
||||
const shortName =
|
||||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
|
||||
|
|
@ -3724,30 +3750,30 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
|
||||
?.orgRootName;
|
||||
?.orgRootName;
|
||||
const shortName =
|
||||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
|
||||
|
|
@ -3931,25 +3957,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -4110,25 +4136,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -4280,25 +4306,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -4711,25 +4737,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -4877,25 +4903,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -5031,25 +5057,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -5356,25 +5382,25 @@ export class OrganizationDotnetController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||
?.orgRoot != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||
: null;
|
||||
const Oc =
|
||||
|
|
@ -5655,16 +5681,16 @@ export class OrganizationDotnetController extends Controller {
|
|||
currentAddress:
|
||||
profile && profile.currentAddress
|
||||
? profile.currentAddress +
|
||||
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
||||
? " ตำบล/แขวง " + profile.currentSubDistrict.name
|
||||
: "") +
|
||||
(profile.currentDistrict && profile.currentDistrict.name
|
||||
? " อำเภอ/เขต " + profile.currentDistrict.name
|
||||
: "") +
|
||||
(profile.currentProvince && profile.currentProvince.name
|
||||
? " จังหวัด " + profile.currentProvince.name
|
||||
: "") +
|
||||
profile.currentZipCode
|
||||
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
||||
? " ตำบล/แขวง " + profile.currentSubDistrict.name
|
||||
: "") +
|
||||
(profile.currentDistrict && profile.currentDistrict.name
|
||||
? " อำเภอ/เขต " + profile.currentDistrict.name
|
||||
: "") +
|
||||
(profile.currentProvince && profile.currentProvince.name
|
||||
? " จังหวัด " + profile.currentProvince.name
|
||||
: "") +
|
||||
profile.currentZipCode
|
||||
: "-",
|
||||
oc: oc ?? "-",
|
||||
root:
|
||||
|
|
@ -5700,26 +5726,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
positions:
|
||||
_position && _position.length > 0
|
||||
? _position.slice(0, -1).map((x: any, idx: number) => ({
|
||||
positionName: x.positionName,
|
||||
dateStart: x.commandDateAffect ?? null,
|
||||
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
||||
positionType: x.positionType,
|
||||
positionLevel: x.positionLevel,
|
||||
orgRoot: x.orgRoot,
|
||||
orgChild1: x.orgChild1,
|
||||
orgChild2: x.orgChild2,
|
||||
orgChild3: x.orgChild3,
|
||||
orgChild4: x.orgChild4,
|
||||
}))
|
||||
positionName: x.positionName,
|
||||
dateStart: x.commandDateAffect ?? null,
|
||||
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
||||
positionType: x.positionType,
|
||||
positionLevel: x.positionLevel,
|
||||
orgRoot: x.orgRoot,
|
||||
orgChild1: x.orgChild1,
|
||||
orgChild2: x.orgChild2,
|
||||
orgChild3: x.orgChild3,
|
||||
orgChild4: x.orgChild4,
|
||||
}))
|
||||
: [],
|
||||
educations:
|
||||
profile.profileEducations && profile.profileEducations.length > 0
|
||||
? profile.profileEducations.map((x) => ({
|
||||
educationLevel: x.educationLevel,
|
||||
institute: x.institute ?? "-",
|
||||
country: x.country ?? "-",
|
||||
finishDate: x.finishDate,
|
||||
}))
|
||||
educationLevel: x.educationLevel,
|
||||
institute: x.institute ?? "-",
|
||||
country: x.country ?? "-",
|
||||
finishDate: x.finishDate,
|
||||
}))
|
||||
: [],
|
||||
};
|
||||
return new HttpSuccess(mapEmpProfile);
|
||||
|
|
@ -5769,16 +5795,16 @@ export class OrganizationDotnetController extends Controller {
|
|||
currentAddress:
|
||||
profile && profile.currentAddress
|
||||
? profile.currentAddress +
|
||||
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
||||
? " ตำบล/แขวง " + profile.currentSubDistrict.name
|
||||
: "") +
|
||||
(profile.currentDistrict && profile.currentDistrict.name
|
||||
? " อำเภอ/เขต " + profile.currentDistrict.name
|
||||
: "") +
|
||||
(profile.currentProvince && profile.currentProvince.name
|
||||
? " จังหวัด " + profile.currentProvince.name
|
||||
: "") +
|
||||
profile.currentZipCode
|
||||
(profile.currentSubDistrict && profile.currentSubDistrict.name
|
||||
? " ตำบล/แขวง " + profile.currentSubDistrict.name
|
||||
: "") +
|
||||
(profile.currentDistrict && profile.currentDistrict.name
|
||||
? " อำเภอ/เขต " + profile.currentDistrict.name
|
||||
: "") +
|
||||
(profile.currentProvince && profile.currentProvince.name
|
||||
? " จังหวัด " + profile.currentProvince.name
|
||||
: "") +
|
||||
profile.currentZipCode
|
||||
: "-",
|
||||
oc: oc ?? "-",
|
||||
root:
|
||||
|
|
@ -5814,26 +5840,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
positions:
|
||||
_position && _position.length > 0
|
||||
? _position.slice(0, -1).map((x: any, idx: number) => ({
|
||||
positionName: x.positionName,
|
||||
dateStart: x.commandDateAffect ?? null,
|
||||
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
||||
positionType: x.positionType,
|
||||
positionLevel: x.positionLevel,
|
||||
orgRoot: x.orgRoot,
|
||||
orgChild1: x.orgChild1,
|
||||
orgChild2: x.orgChild2,
|
||||
orgChild3: x.orgChild3,
|
||||
orgChild4: x.orgChild4,
|
||||
}))
|
||||
positionName: x.positionName,
|
||||
dateStart: x.commandDateAffect ?? null,
|
||||
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
|
||||
positionType: x.positionType,
|
||||
positionLevel: x.positionLevel,
|
||||
orgRoot: x.orgRoot,
|
||||
orgChild1: x.orgChild1,
|
||||
orgChild2: x.orgChild2,
|
||||
orgChild3: x.orgChild3,
|
||||
orgChild4: x.orgChild4,
|
||||
}))
|
||||
: [],
|
||||
educations:
|
||||
profile.profileEducations && profile.profileEducations.length > 0
|
||||
? profile.profileEducations.map((x) => ({
|
||||
educationLevel: x.educationLevel,
|
||||
institute: x.institute ?? "-",
|
||||
country: x.country ?? "-",
|
||||
finishDate: x.finishDate,
|
||||
}))
|
||||
educationLevel: x.educationLevel,
|
||||
institute: x.institute ?? "-",
|
||||
country: x.country ?? "-",
|
||||
finishDate: x.finishDate,
|
||||
}))
|
||||
: [],
|
||||
};
|
||||
return new HttpSuccess(mapProfile);
|
||||
|
|
@ -5969,4 +5995,228 @@ export class OrganizationDotnetController extends Controller {
|
|||
});
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* รายชื่อขรก. ตามสิทธิ์ admin
|
||||
*
|
||||
* @summary รายชื่อขรก. ตามสิทธิ์ admin
|
||||
*
|
||||
*/
|
||||
@Post("officer-by-admin-rolev2")
|
||||
async GetOfficersByAdminRoleV2(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
node: number;
|
||||
nodeId: string;
|
||||
role: string;
|
||||
isRetirement?: boolean;
|
||||
reqNode?: number;
|
||||
reqNodeId?: string;
|
||||
date?: Date;
|
||||
},
|
||||
) {
|
||||
let typeCondition: any = {};
|
||||
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
|
||||
if (body.role === "CHILD") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
typeCondition = {
|
||||
rootDnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 1:
|
||||
typeCondition = {
|
||||
child1DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
typeCondition = {
|
||||
child2DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
typeCondition = {
|
||||
child3DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 4:
|
||||
typeCondition = {
|
||||
child4DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
typeCondition = {};
|
||||
break;
|
||||
}
|
||||
} else if (body.role === "BROTHER") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
typeCondition = {
|
||||
rootDnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 1:
|
||||
typeCondition = {
|
||||
rootDnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
typeCondition = {
|
||||
child1DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
typeCondition = {
|
||||
child2DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
case 4:
|
||||
typeCondition = {
|
||||
child3DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
typeCondition = {};
|
||||
break;
|
||||
}
|
||||
} else if (body.role === "PARENT") {
|
||||
typeCondition = {
|
||||
rootDnaId: body.nodeId,
|
||||
child1DnaId: Not(IsNull()),
|
||||
};
|
||||
}
|
||||
} else if (body.role === "OWNER" || body.role === "ROOT") {
|
||||
switch (body.reqNode) {
|
||||
case 0:
|
||||
typeCondition = {
|
||||
rootDnaId: body.reqNodeId,
|
||||
};
|
||||
break;
|
||||
case 1:
|
||||
typeCondition = {
|
||||
child1DnaId: body.reqNodeId,
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
typeCondition = {
|
||||
child2DnaId: body.reqNodeId,
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
typeCondition = {
|
||||
child3DnaId: body.reqNodeId,
|
||||
};
|
||||
break;
|
||||
case 4:
|
||||
typeCondition = {
|
||||
child4DnaId: body.reqNodeId,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
typeCondition = {};
|
||||
break;
|
||||
}
|
||||
} else if (body.role === "NORMAL") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
typeCondition = {
|
||||
rootDnaId: body.nodeId,
|
||||
child1DnaId: IsNull(),
|
||||
};
|
||||
break;
|
||||
case 1:
|
||||
typeCondition = {
|
||||
child1DnaId: body.nodeId,
|
||||
child2DnaId: IsNull(),
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
typeCondition = {
|
||||
child2DnaId: body.nodeId,
|
||||
child3DnaId: IsNull(),
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
typeCondition = {
|
||||
child3DnaId: body.nodeId,
|
||||
child4DnaId: IsNull(),
|
||||
};
|
||||
break;
|
||||
case 4:
|
||||
typeCondition = {
|
||||
child4DnaId: body.nodeId,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
typeCondition = {};
|
||||
break;
|
||||
}
|
||||
}
|
||||
const date = body.date ? new Date(body.date) : new Date();
|
||||
// set เวลาเป็น 23:59:59 ของวันนั้น
|
||||
date.setHours(23, 59, 59, 999);
|
||||
|
||||
let profile = await this.posMasterHistoryRepository.find({
|
||||
where: {
|
||||
...typeCondition,
|
||||
createdAt: LessThanOrEqual(date),
|
||||
// firstName: Not("") && Not(IsNull()),
|
||||
// lastName: Not("") && Not(IsNull()),
|
||||
},
|
||||
order: {
|
||||
firstName: "ASC",
|
||||
lastName: "ASC",
|
||||
createdAt: "DESC", // ให้ createdAt ล่าสุดอยู่ข้างบน
|
||||
},
|
||||
});
|
||||
|
||||
// group by ancestorDNA แล้วเลือก create_at ล่าสุด
|
||||
const grouped = new Map<string, PosMasterHistory>();
|
||||
for (const item of profile) {
|
||||
const key = `${item.ancestorDNA}`;
|
||||
if (!grouped.has(key)) {
|
||||
grouped.set(key, item);
|
||||
} else {
|
||||
// ถ้าเจอซ้ำ ให้เลือก createdAt ล่าสุด
|
||||
const exist = grouped.get(key);
|
||||
if (exist && item.createdAt > exist.createdAt) {
|
||||
grouped.set(key, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const profile_ = await Promise.all(
|
||||
Array.from(grouped.values())
|
||||
.filter((x) => x.profileId != null)
|
||||
.map(async (item: PosMasterHistory) => {
|
||||
let profile = await this.profileRepo.findOne({
|
||||
where: { id: item.profileId },
|
||||
});
|
||||
|
||||
return {
|
||||
id: item.profileId,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: profile?.citizenId ?? null,
|
||||
dateStart: profile?.dateStart ?? null,
|
||||
dateAppoint: profile?.dateAppoint ?? null,
|
||||
keycloak: profile?.keycloak ?? null,
|
||||
posNo: item.shortName,
|
||||
position: item.position,
|
||||
positionLevel: item.posLevel,
|
||||
positionType: item.posType,
|
||||
// oc: Oc,
|
||||
orgRootId: item.rootDnaId,
|
||||
orgChild1Id: item.child1DnaId,
|
||||
orgChild2Id: item.child2DnaId,
|
||||
orgChild3Id: item.child3DnaId,
|
||||
orgChild4Id: item.child4DnaId,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(profile_);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1663,12 +1663,17 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel?.posLevelName ?? "",
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary,
|
||||
// profileSalary: profile.profileSalary,
|
||||
profileSalary: profile.profileSalary?.map((x) => ({
|
||||
...x,
|
||||
date: x.commandDateAffect ?? new Date()
|
||||
})) ?? [],
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia: profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insigniaId: x.insignia?.id ?? null,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
|
|
@ -1879,7 +1884,12 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
posLevel: profile.posLevel ? profile.posLevel : null,
|
||||
posType: profile.posType ? profile.posType : null,
|
||||
profileSalary: profile.profileSalary,
|
||||
profileInsignia: profile.profileInsignias,
|
||||
// profileInsignia: profile.profileInsignias,
|
||||
profileInsignia: profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insigniaId: x.insignia?.id ?? null,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
}));
|
||||
|
||||
return new HttpSuccess(mapProfile);
|
||||
|
|
@ -2053,12 +2063,21 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
? ""
|
||||
: profile.posType?.posTypeShortName + " ") + (profile.posLevel?.posLevelName ?? ""),
|
||||
posType: profile.posType?.posTypeName ?? "",
|
||||
profileSalary: profile.profileSalary.map((x) => {
|
||||
return { ...x, date: x.commandDateAffect ?? new Date() };
|
||||
}),
|
||||
profileInsignia: profile.profileInsignias.map((x) => {
|
||||
return { ...x, insignia: x.insignia.name };
|
||||
}),
|
||||
// profileSalary: profile.profileSalary.map((x) => {
|
||||
// return { ...x, date: x.commandDateAffect ?? new Date() };
|
||||
// }),
|
||||
profileSalary: profile.profileSalary?.map((x) => ({
|
||||
...x,
|
||||
date: x.commandDateAffect ?? new Date()
|
||||
})) ?? [],
|
||||
// profileInsignia: profile.profileInsignias.map((x) => {
|
||||
// return { ...x, insignia: x.insignia.name };
|
||||
// }),
|
||||
profileInsignia: profile.profileInsignias?.map((x) => ({
|
||||
...x,
|
||||
insigniaId: x.insignia?.id ?? null,
|
||||
insignia: x.insignia?.name ?? null,
|
||||
})) ?? [],
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
|
|||
|
|
@ -10810,10 +10810,11 @@ export class ProfileController extends Controller {
|
|||
system?: string;
|
||||
},
|
||||
) {
|
||||
// ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
|
||||
let _system: string = "SYS_REGISTRY_OFFICER";
|
||||
if (body.system) _system = body.system;
|
||||
let _data = await new permission().PermissionOrgList(request, _system);
|
||||
// comment ออกก่อนเพราะยังไม่ได้ใช้
|
||||
// // ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
|
||||
// let _system: string = "SYS_REGISTRY_OFFICER";
|
||||
// if (body.system) _system = body.system;
|
||||
// let _data = await new permission().PermissionOrgList(request, _system);
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -98,4 +98,52 @@ export class PosMasterHistory extends EntityBase {
|
|||
default: null,
|
||||
})
|
||||
ancestorDNA: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgRoot",
|
||||
default: null,
|
||||
})
|
||||
rootDnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild1",
|
||||
default: null,
|
||||
})
|
||||
child1DnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild2",
|
||||
default: null,
|
||||
})
|
||||
child2DnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild3",
|
||||
default: null,
|
||||
})
|
||||
child3DnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild4",
|
||||
default: null,
|
||||
})
|
||||
child4DnaId: string;
|
||||
}
|
||||
|
|
|
|||
24
src/migration/1766760828376-add_field_dnaid_and_prodileid.ts
Normal file
24
src/migration/1766760828376-add_field_dnaid_and_prodileid.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddFieldDnaidAndProdileid1766760828376 implements MigrationInterface {
|
||||
name = 'AddFieldDnaidAndProdileid1766760828376'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`rootDnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgRoot'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child1DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild1'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child2DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild2'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child3DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild3'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child4DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild4'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child4DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child3DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child2DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child1DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`rootDnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`profileId\``);
|
||||
}
|
||||
|
||||
}
|
||||
18
src/migration/1767930614165-update_table_posMasterHistory.ts
Normal file
18
src/migration/1767930614165-update_table_posMasterHistory.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTablePosMasterHistory1767930614165 implements MigrationInterface {
|
||||
name = 'UpdateTablePosMasterHistory1767930614165'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`rootDnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgRoot'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child1DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild1'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child2DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild2'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child3DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild3'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child4DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild4'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ export async function CreatePosMasterHistoryOfficer(
|
|||
if (!pm.ancestorDNA) return false;
|
||||
|
||||
const checkCurrentRevision = await repoOrgRevision.findOne({
|
||||
where:{
|
||||
where: {
|
||||
id: pm.orgRevisionId,
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false
|
||||
|
|
@ -54,12 +54,18 @@ export async function CreatePosMasterHistoryOfficer(
|
|||
? pm.positions.find((p) => p.positionIsSelected === true) ?? null
|
||||
: null;
|
||||
h.ancestorDNA = pm.ancestorDNA ? pm.ancestorDNA : _null;
|
||||
if(!type || type != "DELETE"){
|
||||
if(checkCurrentRevision){
|
||||
if (!type || type != "DELETE") {
|
||||
if (checkCurrentRevision) {
|
||||
h.prefix = pm.current_holder?.prefix || _null;
|
||||
h.firstName = pm.current_holder?.firstName || _null;
|
||||
h.lastName = pm.current_holder?.lastName || _null;
|
||||
}else{
|
||||
h.profileId = pm.current_holder?.id || _null;
|
||||
h.rootDnaId = pm.orgRoot?.ancestorDNA || _null;
|
||||
h.child1DnaId = pm.orgChild1?.ancestorDNA || _null;
|
||||
h.child2DnaId = pm.orgChild2?.ancestorDNA || _null;
|
||||
h.child3DnaId = pm.orgChild3?.ancestorDNA || _null;
|
||||
h.child4DnaId = pm.orgChild4?.ancestorDNA || _null;
|
||||
} else {
|
||||
h.prefix = pm.next_holder?.prefix || _null;
|
||||
h.firstName = pm.next_holder?.firstName || _null;
|
||||
h.lastName = pm.next_holder?.lastName || _null;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import { PermissionOrg } from "../entities/PermissionOrg";
|
|||
import { sendWebSocket } from "./webSocket";
|
||||
import { CreatePosMasterHistoryOfficer } from "./PositionService";
|
||||
import { PayloadSendNoti } from "../interfaces/utils";
|
||||
import { PermissionProfile } from "../entities/PermissionProfile";
|
||||
|
||||
export let sendToQueue: (payload: any) => void;
|
||||
export let sendToQueueOrg: (payload: any) => void;
|
||||
|
|
@ -496,6 +497,8 @@ async function handler_command_noti(msg: amqp.ConsumeMessage): Promise<boolean>
|
|||
async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
|
||||
//----> condition before process consume
|
||||
const repoPosmaster = AppDataSource.getRepository(PosMaster);
|
||||
const posMasterAssignRepository = AppDataSource.getRepository(PosMasterAssign);
|
||||
const permissionProfilesRepository = AppDataSource.getRepository(PermissionProfile);
|
||||
const repoEmployeePosmaster = AppDataSource.getRepository(EmployeePosMaster);
|
||||
const repoEmployeeTempPosmaster = AppDataSource.getRepository(EmployeeTempPosMaster);
|
||||
const repoProfile = AppDataSource.getRepository(Profile);
|
||||
|
|
@ -557,8 +560,75 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
"positions.posExecutive",
|
||||
],
|
||||
});
|
||||
// // xxx
|
||||
// // ดึง assignment ของ revision เดิม
|
||||
// const oldAssigns = await posMasterAssignRepository.find({
|
||||
// relations: ["posMaster"],
|
||||
// where: {
|
||||
// posMaster: {
|
||||
// orgRevisionId: orgRevisionPublish?.id,
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
// // สร้าง Map: ancestorDNA → assignments[]
|
||||
// const assignMap = new Map<string, PosMasterAssign[]>();
|
||||
// for (const a of oldAssigns) {
|
||||
// const dna = a.posMaster.ancestorDNA;
|
||||
// if (!assignMap.has(dna)) {
|
||||
// assignMap.set(dna, []);
|
||||
// }
|
||||
// assignMap.get(dna)!.push(a);
|
||||
// }
|
||||
// const permissionProfiles = await permissionProfilesRepository.find({
|
||||
// relations: ["orgRootTree"],
|
||||
// where: {
|
||||
// orgRootTree: {
|
||||
// orgRevisionId: orgRevisionPublish?.id,
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// const permissionMap = new Map<string, PermissionProfile[]>();
|
||||
// for (const p of permissionProfiles) {
|
||||
// const dna = p.orgRootTree.ancestorDNA;
|
||||
// if (!permissionMap.has(dna)) {
|
||||
// permissionMap.set(dna, []);
|
||||
// }
|
||||
// permissionMap.get(dna)!.push(p);
|
||||
// }
|
||||
// const newRoots = await orgRootRepository.find({
|
||||
// where: { orgRevisionId: orgRevisionDraft?.id },
|
||||
// });
|
||||
// const newRootMap = new Map(
|
||||
// newRoots.map(r => [r.ancestorDNA, r.id])
|
||||
// );
|
||||
const _null: any = null;
|
||||
for (const item of posMaster) {
|
||||
// /* ===============================
|
||||
// * Clone posMasterAssign & permissionProfiles xxx
|
||||
// * =============================== */
|
||||
// const assigns = assignMap.get(item.ancestorDNA);
|
||||
|
||||
// if (assigns && assigns.length > 0) {
|
||||
// const newAssigns = assigns.map(({ id, ...rest }) => ({
|
||||
// ...rest, // copy ทุก field ยกเว้น id
|
||||
// posMasterId: item.id, // ผูกกับ posMaster ใหม่
|
||||
// }));
|
||||
|
||||
// await posMasterAssignRepository.save(newAssigns);
|
||||
// }
|
||||
|
||||
// const perms = permissionMap.get(item.ancestorDNA);
|
||||
// const newRootId = newRootMap.get(item.ancestorDNA);
|
||||
|
||||
// if (perms && perms.length > 0 && newRootId) {
|
||||
// const newPerms = perms.map(({ id, orgRootTree, ...rest }) => ({
|
||||
// ...rest, // profileId, isEdit, isCheck
|
||||
// orgRootId: newRootId,
|
||||
// }));
|
||||
|
||||
// await permissionProfilesRepository.save(newPerms);
|
||||
// }
|
||||
|
||||
if (item.next_holderId != null) {
|
||||
const profile = await repoProfile.findOne({
|
||||
where: { id: item.next_holderId == null ? "" : item.next_holderId },
|
||||
|
|
@ -1798,13 +1868,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
posMaster.lastUpdatedAt = new Date();
|
||||
await posMasterRepository.save(posMaster);
|
||||
|
||||
// Copy assignments
|
||||
await posMasterAssignRepository.save(
|
||||
posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
...rest,
|
||||
posMasterId: posMaster.id,
|
||||
})),
|
||||
);
|
||||
// // Copy assignments
|
||||
// await posMasterAssignRepository.save(
|
||||
// posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
// ...rest,
|
||||
// posMasterId: posMaster.id,
|
||||
// })),
|
||||
// );
|
||||
|
||||
// Create positions
|
||||
for await (const pos of item.positions) {
|
||||
|
|
@ -1895,13 +1965,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
posMaster.lastUpdatedAt = new Date();
|
||||
await posMasterRepository.save(posMaster);
|
||||
|
||||
// Copy assignments
|
||||
await posMasterAssignRepository.save(
|
||||
posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
...rest,
|
||||
posMasterId: posMaster.id,
|
||||
})),
|
||||
);
|
||||
// // Copy assignments
|
||||
// await posMasterAssignRepository.save(
|
||||
// posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
// ...rest,
|
||||
// posMasterId: posMaster.id,
|
||||
// })),
|
||||
// );
|
||||
|
||||
// Create positions
|
||||
for await (const pos of item.positions) {
|
||||
|
|
@ -1994,13 +2064,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
posMaster.lastUpdatedAt = new Date();
|
||||
await posMasterRepository.save(posMaster);
|
||||
|
||||
// Copy assignments
|
||||
await posMasterAssignRepository.save(
|
||||
posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
...rest,
|
||||
posMasterId: posMaster.id,
|
||||
})),
|
||||
);
|
||||
// // Copy assignments
|
||||
// await posMasterAssignRepository.save(
|
||||
// posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
// ...rest,
|
||||
// posMasterId: posMaster.id,
|
||||
// })),
|
||||
// );
|
||||
|
||||
// Create positions
|
||||
for await (const pos of item.positions) {
|
||||
|
|
@ -2095,13 +2165,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
posMaster.lastUpdatedAt = new Date();
|
||||
await posMasterRepository.save(posMaster);
|
||||
|
||||
// Copy assignments
|
||||
await posMasterAssignRepository.save(
|
||||
posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
...rest,
|
||||
posMasterId: posMaster.id,
|
||||
})),
|
||||
);
|
||||
// // Copy assignments
|
||||
// await posMasterAssignRepository.save(
|
||||
// posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
// ...rest,
|
||||
// posMasterId: posMaster.id,
|
||||
// })),
|
||||
// );
|
||||
|
||||
// Create positions
|
||||
for await (const pos of item.positions) {
|
||||
|
|
@ -2199,13 +2269,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
posMaster.lastUpdatedAt = new Date();
|
||||
await posMasterRepository.save(posMaster);
|
||||
|
||||
// Copy assignments
|
||||
await posMasterAssignRepository.save(
|
||||
posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
...rest,
|
||||
posMasterId: posMaster.id,
|
||||
})),
|
||||
);
|
||||
// // Copy assignments
|
||||
// await posMasterAssignRepository.save(
|
||||
// posMasterAssign.map(({ id, ...rest }: PosMasterAssign) => ({
|
||||
// ...rest,
|
||||
// posMasterId: posMaster.id,
|
||||
// })),
|
||||
// );
|
||||
|
||||
// Create positions
|
||||
for await (const pos of item.positions) {
|
||||
|
|
@ -2287,9 +2357,30 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
await child3Repository.delete({ orgRevisionId: In(_orgRevisions.map((x) => x.id)) });
|
||||
await child2Repository.delete({ orgRevisionId: In(_orgRevisions.map((x) => x.id)) });
|
||||
await child1Repository.delete({ orgRevisionId: In(_orgRevisions.map((x) => x.id)) });
|
||||
await permissionOrgRepository.delete({
|
||||
orgRootId: In(_roots.map((x) => x.id)),
|
||||
});
|
||||
// ถ้าเลือกทำสำเนาให้อัพเดทจากแบบร่างเดิมไปแบบร่างใหม่แทนการลบ xxx
|
||||
if (["ORG", "ORG_POSITION", "ORG_POSITION_PERSON", "ORG_POSITION_ROLE", "ORG_POSITION_PERSON_ROLE"].includes(requestBody.typeDraft?.toUpperCase()))
|
||||
{
|
||||
const _newRoots = await orgRootRepository.find({
|
||||
where: { orgRevisionId: revision.id}
|
||||
});
|
||||
const newRootMap = new Map(
|
||||
_newRoots.map(r => [r.ancestorDNA, r.id])
|
||||
);
|
||||
for (const oldRoot of _roots) {
|
||||
const newRootId = newRootMap.get(oldRoot.ancestorDNA);
|
||||
if (!newRootId) continue;
|
||||
// อัพเดท orgRootId ที่อยู่ภายใต้ orgRevision แบบร่างเดิมเป็นของ orgRevision แบบร่างใหม่
|
||||
await permissionOrgRepository.update(
|
||||
{ orgRootId: oldRoot.id },
|
||||
{ orgRootId: newRootId }
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
await permissionOrgRepository.delete({
|
||||
orgRootId: In(_roots.map((x) => x.id)),
|
||||
});
|
||||
}
|
||||
await orgRootRepository.delete({ orgRevisionId: In(_orgRevisions.map((x) => x.id)) });
|
||||
await orgRevisionRepository.remove(_orgRevisions);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue