14-05-2025 added expedited fee, feecomm for mssql with sql conversion from oracle local dev done
This commit is contained in:
parent
aff1e69dec
commit
4c66a1a252
@ -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, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@Controller('mssql')
|
@Controller('mssql')
|
||||||
@ -106,41 +106,41 @@ export class ManageFeeController {
|
|||||||
|
|
||||||
// Expedited Fee
|
// Expedited Fee
|
||||||
|
|
||||||
// @ApiTags('Manage Fee - Oracle')
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
// @Get('/GetEfFeeRates')
|
// @Get('/GetEfFeeRates')
|
||||||
// GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
GetEfFeeRates(@Query() body: GetFeeGeneralDTO) {
|
||||||
// return this.manageFeeService.GETEFFEERATES(body);
|
return this.manageFeeService.GETEFFEERATES(body);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @ApiTags('Manage Fee - Oracle')
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
// @Post('/CreateEfFee')
|
// @Post('/CreateEfFee')
|
||||||
// CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
||||||
// return this.manageFeeService.CREATEEFFEE(body);
|
return this.manageFeeService.CREATEEFFEE(body);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @ApiTags('Manage Fee - Oracle')
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
// @Patch('/UpdateEfFee')
|
// @Patch('/UpdateEfFee')
|
||||||
// UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
||||||
// return this.manageFeeService.UPDATEEFFEE(body);
|
return this.manageFeeService.UPDATEEFFEE(body);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Fee Comm
|
// Fee Comm
|
||||||
|
|
||||||
// @ApiTags('Manage Fee - Oracle')
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
// @Get('/GetFeeComm')
|
// @Get('/GetFeeComm')
|
||||||
// GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
GetFeeComm(@Query() body: GetFeeGeneralDTO) {
|
||||||
// return this.manageFeeService.GETFEECOMM(body);
|
return this.manageFeeService.GETFEECOMM(body);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @ApiTags('Manage Fee - Oracle')
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
// @Post('/CreateFeeComm')
|
// @Post('/CreateFeeComm')
|
||||||
// CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
||||||
// return this.manageFeeService.CREATEFEECOMM(body);
|
return this.manageFeeService.CREATEFEECOMM(body);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @ApiTags('Manage Fee - Oracle')
|
// @ApiTags('Manage Fee - Mssql')
|
||||||
// @Patch('/UpdateFeeComm')
|
// @Patch('/UpdateFeeComm')
|
||||||
// UpdateFeeComm(@Body() body: UpdateFeeCommDTO) {
|
UpdateFeeComm(@Body() body: UpdateFeeCommDTO) {
|
||||||
// return this.manageFeeService.UPDATEFEECOMM(body);
|
return this.manageFeeService.UPDATEFEECOMM(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, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO } from 'src/oracle/manage-fee/manage-fee.dto';
|
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, GetFeeGeneralDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO } 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';
|
||||||
@ -308,4 +308,128 @@ export class ManageFeeService {
|
|||||||
throw new InternalServerException();
|
throw new InternalServerException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expedited fee
|
||||||
|
|
||||||
|
async GETEFFEERATES(body: GetFeeGeneralDTO): Promise<any[]> {
|
||||||
|
|
||||||
|
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.GetEFFeeRates');
|
||||||
|
if (result.recordset) {
|
||||||
|
return result.recordset;
|
||||||
|
}
|
||||||
|
throw new BadRequestException();
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof BadRequestException) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async CREATEEFFEE(body: CreateEfFeeDTO) {
|
||||||
|
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_CUSTOMERTYPE', mssql.VarChar(20), body.P_CUSTOMERTYPE);
|
||||||
|
request.input('P_DELIVERYTYPE', mssql.VarChar(20), body.P_DELIVERYTYPE);
|
||||||
|
request.input('P_STARTTIME', mssql.Int, body.P_STARTTIME);
|
||||||
|
request.input('P_ENDTIME', mssql.Int, body.P_ENDTIME);
|
||||||
|
request.input('P_TIMEZONE', mssql.VarChar(3), body.P_TIMEZONE);
|
||||||
|
request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE);
|
||||||
|
request.input('P_FEES', mssql.Float, body.P_FEES);
|
||||||
|
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
|
||||||
|
const result = await request.execute('carnetsys.CreateEFFee');
|
||||||
|
return result.recordset;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async UPDATEEFFEE(body: UpdateEfFeeDTO) {
|
||||||
|
|
||||||
|
let connection: Connection;
|
||||||
|
try {
|
||||||
|
connection = await this.mssqlDBService.getConnection();
|
||||||
|
const request = new Request(connection);
|
||||||
|
request.input('P_EFFEESETUPID', mssql.Int, body.P_EFFEESETUPID);
|
||||||
|
request.input('P_FEES', mssql.Float, body.P_FEES);
|
||||||
|
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.UpdateEFFee');
|
||||||
|
return result.recordset;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fee comm
|
||||||
|
|
||||||
|
async GETFEECOMM(body: GetFeeGeneralDTO): Promise<any[]> {
|
||||||
|
|
||||||
|
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.GetFeecomm');
|
||||||
|
if (result.recordset) {
|
||||||
|
return result.recordset;
|
||||||
|
}
|
||||||
|
throw new BadRequestException();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
|
||||||
|
if (error instanceof BadRequestException) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async CREATEFEECOMM(body: CreateFeeCommDTO) {
|
||||||
|
|
||||||
|
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_PARAMID', mssql.Int, body.P_PARAMID);
|
||||||
|
request.input('P_COMMRATE', mssql.Float, body.P_COMMRATE);
|
||||||
|
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.CreateFeeComm');
|
||||||
|
return result.recordset;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async UPDATEFEECOMM(body: UpdateFeeCommDTO) {
|
||||||
|
let connection: Connection;
|
||||||
|
try {
|
||||||
|
connection = await this.mssqlDBService.getConnection();
|
||||||
|
const request = new Request(connection);
|
||||||
|
request.input('P_FEECOMMID', mssql.Int, body.P_FEECOMMID);
|
||||||
|
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.UpdateFeeComm');
|
||||||
|
return result.recordset;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
throw new InternalServerException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export class GetFeeGeneralDTO {
|
|||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@Matches(/^.{6}$|^.{8}$/, {
|
@Matches(/^.{6}$|^.{8}$/, {
|
||||||
message: 'Property P_ACTIVE_INACTIVE must be either too long or short',
|
message: 'Property P_ACTIVE_INACTIVE is invalid',
|
||||||
})
|
})
|
||||||
@IsString({ message: 'Property P_ACTIVE_INACTIVE must be a string' })
|
@IsString({ message: 'Property P_ACTIVE_INACTIVE must be a string' })
|
||||||
@IsDefined({ message: 'Property P_ACTIVE_INACTIVE is required' })
|
@IsDefined({ message: 'Property P_ACTIVE_INACTIVE is required' })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user