home page data
This commit is contained in:
parent
4026055b7d
commit
df898db480
@ -114,6 +114,10 @@ export class AuthService {
|
|||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if(!crows[0].SPID){
|
||||||
|
return {error:"Invalid username or password"}
|
||||||
|
}
|
||||||
|
|
||||||
return {rows,chartResult:crows};
|
return {rows,chartResult:crows};
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
269
src/oracle/homePageData.service.ts
Normal file
269
src/oracle/homePageData.service.ts
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
import { Injectable } from "@nestjs/common";
|
||||||
|
import { OracleDBService } from "src/db/db.service";
|
||||||
|
import * as oracledb from 'oracledb'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class HomePageDataService {
|
||||||
|
|
||||||
|
constructor(private readonly oracleDBService: OracleDBService) { }
|
||||||
|
|
||||||
|
async GetHomePageData(P_spid: number) {
|
||||||
|
let connection;
|
||||||
|
let p_basic_details = [];
|
||||||
|
let p_contacts = []
|
||||||
|
let p_sequence = [];
|
||||||
|
let p_fees_comm = [];
|
||||||
|
let p_bf_fee = [];
|
||||||
|
let p_cf_Fee = [];
|
||||||
|
let p_cont_sheet_fee = [];
|
||||||
|
let p_ef_fee = [];
|
||||||
|
let p_security_deposit = [];
|
||||||
|
let p_param = [];
|
||||||
|
let p_region = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection()
|
||||||
|
if (!connection) {
|
||||||
|
throw new Error('No DB Connected')
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
USERLOGIN_PKG.GetHomePageData(
|
||||||
|
:P_spid,
|
||||||
|
:p_basic_details_cur,
|
||||||
|
:p_contacts_cur,
|
||||||
|
:p_sequence_cur,
|
||||||
|
:p_fees_comm_cur,
|
||||||
|
:p_bf_fee_cur,
|
||||||
|
:p_cf_Fee_cur,
|
||||||
|
:p_cont_sheet_fee_cur,
|
||||||
|
:p_ef_fee_cur,
|
||||||
|
:p_security_deposit_cur,
|
||||||
|
:p_param_cur,
|
||||||
|
:p_region_cur
|
||||||
|
);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_spid: {
|
||||||
|
val: P_spid,
|
||||||
|
type: oracledb.DB_TYPE_NUMBER,
|
||||||
|
},
|
||||||
|
p_basic_details_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_contacts_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_sequence_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_fees_comm_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_bf_fee_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_cf_Fee_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_cont_sheet_fee_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_ef_fee_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_security_deposit_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_param_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
p_region_cur: {
|
||||||
|
type: oracledb.CURSOR,
|
||||||
|
dir: oracledb.BIND_OUT
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_basic_details_cur) {
|
||||||
|
const cursor = result.outBinds.p_basic_details_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_basic_details = p_basic_details.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_contacts_cur) {
|
||||||
|
const cursor = result.outBinds.p_contacts_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_contacts = p_contacts.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_sequence_cur) {
|
||||||
|
const cursor = result.outBinds.p_sequence_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_sequence = p_sequence.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_fees_comm_cur) {
|
||||||
|
const cursor = result.outBinds.p_fees_comm_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_fees_comm = p_fees_comm.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_bf_fee_cur) {
|
||||||
|
const cursor = result.outBinds.p_bf_fee_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_bf_fee = p_bf_fee.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_cf_Fee_cur) {
|
||||||
|
const cursor = result.outBinds.p_cf_Fee_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_cf_Fee = p_cf_Fee.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_cont_sheet_fee_cur) {
|
||||||
|
const cursor = result.outBinds.p_cont_sheet_fee_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_cont_sheet_fee = p_cont_sheet_fee.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_ef_fee_cur) {
|
||||||
|
const cursor = result.outBinds.p_ef_fee_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_ef_fee = p_ef_fee.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_security_deposit_cur) {
|
||||||
|
const cursor = result.outBinds.p_security_deposit_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_security_deposit = p_security_deposit.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_param_cur) {
|
||||||
|
const cursor = result.outBinds.p_param_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_param = p_param.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.outBinds && result.outBinds.p_region_cur) {
|
||||||
|
const cursor = result.outBinds.p_region_cur;
|
||||||
|
let rowsBatch;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rowsBatch = await cursor.getRows(100);
|
||||||
|
p_region = p_region.concat(rowsBatch);
|
||||||
|
} while (rowsBatch.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
await cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
throw new Error('No cursor returned from the stored procedure');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
p_basic_details,
|
||||||
|
p_contacts,
|
||||||
|
p_sequence,
|
||||||
|
p_fees_comm,
|
||||||
|
p_bf_fee,
|
||||||
|
p_cf_Fee,
|
||||||
|
p_cont_sheet_fee,
|
||||||
|
p_ef_fee,
|
||||||
|
p_security_deposit,
|
||||||
|
p_param,
|
||||||
|
p_region,
|
||||||
|
};
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching users: ', err);
|
||||||
|
throw new Error('Error fetching users');
|
||||||
|
} finally { }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,13 +4,23 @@ import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDT
|
|||||||
import { ParamTableService } from './paramTable.service';
|
import { ParamTableService } from './paramTable.service';
|
||||||
import { ManageFeeService } from './manageFee.service';
|
import { ManageFeeService } from './manageFee.service';
|
||||||
import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger';
|
import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
|
import { HomePageDataService } from './homePageData.service';
|
||||||
|
|
||||||
@Controller('oracle')
|
@Controller('oracle')
|
||||||
export class OracleController {
|
export class OracleController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly oarcleService: OracleService,
|
private readonly oarcleService: OracleService,
|
||||||
private readonly paramTableService: ParamTableService,
|
private readonly paramTableService: ParamTableService,
|
||||||
private readonly manageFeeService: ManageFeeService) { }
|
private readonly manageFeeService: ManageFeeService,
|
||||||
|
private readonly homePageDataService: HomePageDataService
|
||||||
|
) { }
|
||||||
|
|
||||||
|
// HomePageData
|
||||||
|
@ApiTags('HomePageData - Oracle')
|
||||||
|
@Get('/GetHomePageData/:id')
|
||||||
|
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
|
||||||
|
return this.homePageDataService.GetHomePageData(id);
|
||||||
|
}
|
||||||
|
|
||||||
// Regions
|
// Regions
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,12 @@ import { OracleController } from './oracle.controller';
|
|||||||
import { DbModule } from 'src/db/db.module';
|
import { DbModule } from 'src/db/db.module';
|
||||||
import { ParamTableService } from './paramTable.service';
|
import { ParamTableService } from './paramTable.service';
|
||||||
import { ManageFeeService } from './manageFee.service';
|
import { ManageFeeService } from './manageFee.service';
|
||||||
|
import { HomePageDataService } from './homePageData.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[DbModule],
|
imports:[DbModule],
|
||||||
providers: [OracleService,ParamTableService,ManageFeeService],
|
providers: [OracleService,ParamTableService,ManageFeeService,HomePageDataService],
|
||||||
controllers: [OracleController],
|
controllers: [OracleController],
|
||||||
exports:[OracleService,ParamTableService,ManageFeeService]
|
exports:[OracleService,ParamTableService,ManageFeeService,HomePageDataService]
|
||||||
})
|
})
|
||||||
export class OracleModule {}
|
export class OracleModule {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user