added cargo rate
This commit is contained in:
parent
d3fb3e6365
commit
61a72c5df6
18
ormconfig.ts
18
ormconfig.ts
@ -15,17 +15,17 @@ export const OracleConfig: any = {
|
|||||||
export const MssqlConfig: any = {
|
export const MssqlConfig: any = {
|
||||||
// type: 'mssql',
|
// type: 'mssql',
|
||||||
|
|
||||||
// server: 'localhost',
|
server: 'localhost',
|
||||||
// user: 'mssql1433',
|
user: 'mssql1433',
|
||||||
// password: 'root',
|
password: 'root',
|
||||||
// database: 'CarnetDB',
|
|
||||||
|
|
||||||
server: '172.31.18.76',
|
|
||||||
port: 1433,
|
|
||||||
user: 'Carnetsys',
|
|
||||||
password: 'Carnet1234',
|
|
||||||
database: 'CarnetDB',
|
database: 'CarnetDB',
|
||||||
|
|
||||||
|
// server: '172.31.18.76',
|
||||||
|
// port: 1433,
|
||||||
|
// user: 'Carnetsys',
|
||||||
|
// password: 'Carnet1234',
|
||||||
|
// database: 'CarnetDB',
|
||||||
|
|
||||||
// entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
// entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
||||||
// synchronize: true,
|
// synchronize: true,
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Body, Controller, Get, Patch, Post, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Patch, Post, Query } from '@nestjs/common';
|
||||||
import { ManageFeeService } from './manage-fee.service';
|
import { ManageFeeService } from './manage-fee.service';
|
||||||
import { CreateBasicFeeDTO, CreateBondRateDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('mssql')
|
@Controller('mssql')
|
||||||
@ -43,4 +43,24 @@ export class ManageFeeController {
|
|||||||
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
||||||
return this.manageFeeService.UPDATEBONDRATE(body);
|
return this.manageFeeService.UPDATEBONDRATE(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cargo Rate
|
||||||
|
|
||||||
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
|
// @Get('/GetCargoRates')
|
||||||
|
GetCargoRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
|
return this.manageFeeService.GETCARGORATES(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
|
// @Post('/CreateCargoRate')
|
||||||
|
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
||||||
|
return this.manageFeeService.CREATECARGORATE(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
|
// @Patch('/UpdateCargoRate')
|
||||||
|
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
||||||
|
return this.manageFeeService.UPDATECARGORATE(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
import { MssqlDBService, OracleDBService } from 'src/db/db.service';
|
import { MssqlDBService, OracleDBService } from 'src/db/db.service';
|
||||||
import { InternalServerException } from 'src/exceptions/internalServerError.exception';
|
import { InternalServerException } from 'src/exceptions/internalServerError.exception';
|
||||||
import { CreateBasicFeeDTO, CreateBondRateDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
||||||
import * as oracledb from 'oracledb';
|
import * as oracledb from 'oracledb';
|
||||||
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
||||||
import { Connection, Request } from 'mssql';
|
import { Connection, Request } from 'mssql';
|
||||||
@ -76,6 +76,7 @@ export class ManageFeeService {
|
|||||||
request.input('p_active_inactive', mssql.VarChar(8), body.P_ACTIVE_INACTIVE);
|
request.input('p_active_inactive', mssql.VarChar(8), body.P_ACTIVE_INACTIVE);
|
||||||
const result = await request.execute('carnetsys.GetBondRates');
|
const result = await request.execute('carnetsys.GetBondRates');
|
||||||
return result.recordset;
|
return result.recordset;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
||||||
@ -124,4 +125,63 @@ export class ManageFeeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CArgo Rate
|
||||||
|
|
||||||
|
async GETCARGORATES(body: GetFeeGeneralDTO): Promise<any[] | object> {
|
||||||
|
let connection: Connection;
|
||||||
|
try {
|
||||||
|
connection = await this.mssqlDBService.getConnection();
|
||||||
|
const request = new Request(connection);
|
||||||
|
request.input('p_spid', mssql.Int, body.P_SPID);
|
||||||
|
request.input('p_active_inactive', mssql.VarChar(8), body.P_ACTIVE_INACTIVE);
|
||||||
|
const result = await request.execute('carnetsys.GetCargoRates');
|
||||||
|
if (result.recordset) {
|
||||||
|
return result.recordset;
|
||||||
|
}
|
||||||
|
throw new BadRequestException();
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof BadRequestException) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async CREATECARGORATE(body: CreateCargoRateDTO) {
|
||||||
|
let connection: Connection;
|
||||||
|
try {
|
||||||
|
connection = await this.mssqlDBService.getConnection();
|
||||||
|
const request = new Request(connection);
|
||||||
|
request.input('P_SPID', mssql.Int, body.P_SPID);
|
||||||
|
request.input('P_CARNETTYPE', mssql.VarChar(20), body.P_CARNETTYPE);
|
||||||
|
request.input('P_STARTSETS', mssql.Int, body.P_STARTSETS);
|
||||||
|
request.input('P_ENDSETS', mssql.Int, body.P_ENDSETS);
|
||||||
|
request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE);
|
||||||
|
request.input('P_RATE', mssql.Float, body.P_RATE);
|
||||||
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
|
const result = await request.execute('carnetsys.CreateCargoRate');
|
||||||
|
return result.recordset;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async UPDATECARGORATE(body: UpdateCargoRateDTO) {
|
||||||
|
let connection: Connection;
|
||||||
|
try {
|
||||||
|
connection = await this.mssqlDBService.getConnection();
|
||||||
|
const request = new Request(connection);
|
||||||
|
request.input('P_CARGORATESETUPID', mssql.Int, body.P_CARGORATESETUPID);
|
||||||
|
request.input('P_RATE', mssql.Float, body.P_RATE);
|
||||||
|
request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE);
|
||||||
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
|
const result = await request.execute('carnetsys.UpdateCargoRate');
|
||||||
|
return result.recordset;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user