diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index 55adddf7..e4140d2a 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -316,10 +316,9 @@ export class ImportDataController extends Controller { existingProfile.map(async (item) => { rowCount++; const profileSalary = new ProfileSalary(); - profileSalary.date = - item.MP_POS_DATE == "" - ? null_ - : new Date(item.MP_POS_DATE.replace(" +0700 +07:00", "")); + profileSalary.date = item.MP_POS_DATE + ? new Date(item.MP_POS_DATE.replace(" +0700 +07:00", "")) + : null_; const SALARY: any = item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY); profileSalary.amount = SALARY; @@ -344,8 +343,8 @@ export class ImportDataController extends Controller { profileSalary.templateDoc = item.REMARK; profileSalary.refCommandDate = item.MP_COMMAND_DATE == "" - ? null_ - : new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", "")); + ? new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", "")) + : null_; profileSalary.refCommandCode = item.FLAG_TO_NAME_CODE; profileSalary.refCommandName = item.FLAG_TO_NAME; profileSalary.orgRoot = item.DEPARTMENT_NAME; @@ -364,12 +363,12 @@ export class ImportDataController extends Controller { profileSalary.lastUpdateFullName = request.user.name; profileSalary.createdAt = item.USER_CREATE == "" - ? null_ - : new Date(item.USER_CREATE.replace(" +0700 +07:00", "")); + ? new Date(item.USER_CREATE.replace(" +0700 +07:00", "")) + : null_; profileSalary.lastUpdatedAt = item.USER_UPDATE == "" - ? null_ - : new Date(item.USER_UPDATE.replace(" +0700 +07:00", "")); + ? new Date(item.USER_UPDATE.replace(" +0700 +07:00", "")) + : null_; console.log(">>>>>>>>>>>>>>>>>>>" + rowCount); await this.salaryRepo.save(profileSalary); }), @@ -430,8 +429,8 @@ export class ImportDataController extends Controller { const profileSalary = new ProfileSalary(); profileSalary.date = item.MP_POS_DATE == "" - ? null_ - : new Date(item.MP_POS_DATE.replace(" +0700 +07:00", "")); + ? new Date(item.MP_POS_DATE.replace(" +0700 +07:00", "")) + : null_; const SALARY: any = item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY); profileSalary.amount = SALARY; @@ -456,8 +455,8 @@ export class ImportDataController extends Controller { profileSalary.templateDoc = item.REMARK; profileSalary.refCommandDate = item.MP_COMMAND_DATE == "" - ? null_ - : new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", "")); + ? new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", "")) + : null_; profileSalary.refCommandCode = item.FLAG_TO_NAME_CODE; profileSalary.refCommandName = item.FLAG_TO_NAME; profileSalary.orgRoot = item.DEPARTMENT_NAME; @@ -476,12 +475,12 @@ export class ImportDataController extends Controller { profileSalary.lastUpdateFullName = request.user.name; profileSalary.createdAt = item.USER_CREATE == "" - ? null_ - : new Date(item.USER_CREATE.replace(" +0700 +07:00", "")); + ? new Date(item.USER_CREATE.replace(" +0700 +07:00", "")) + : null_; profileSalary.lastUpdatedAt = item.USER_UPDATE == "" - ? null_ - : new Date(item.USER_UPDATE.replace(" +0700 +07:00", "")); + ? new Date(item.USER_UPDATE.replace(" +0700 +07:00", "")) + : null_; console.log(">>>>>>>>>>>>>>>>>>>" + rowCount); await this.salaryRepo.save(profileSalary); }), diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index f20ac340..bfabe4ac 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -5468,7 +5468,9 @@ export class OrganizationController extends Controller { * */ @Post("find/node-all") - async findNodeAllOrg(@Body() requestBody: { node: number; nodeId: string; isRoot: boolean }) { + async findNodeAllOrg( + @Body() requestBody: { node: number | null; nodeId: string | null; isRoot: boolean }, + ) { let orgRootRankSub = ["DISTRICT"]; if (requestBody.isRoot == true) { orgRootRankSub = ["BUREAU", "OFFICE"]; @@ -5476,7 +5478,7 @@ export class OrganizationController extends Controller { switch (requestBody.node) { case 0: { const data = await this.orgRootRepository.find({ - where: { id: requestBody.nodeId, orgRootRankSub: In(orgRootRankSub) }, + where: { id: requestBody.nodeId ?? "", orgRootRankSub: In(orgRootRankSub) }, }); return new HttpSuccess( data.map((y) => ({