382 lines
17 KiB
C#
382 lines
17 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using LCU.API.Collections.RepoApi.Configuration;
|
|
using LCU.API.Collections.RepoApi.Models.Requests;
|
|
using LCU.API.Collections.RepoApi.Services.Reporting;
|
|
using LCU.Shared.Collections.RepoApiLib.Models.Reporting.Responses;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.FeatureManagement.Mvc;
|
|
using Serilog;
|
|
|
|
namespace LCU.API.Collections.RepoApi.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[FeatureGate(FeatureFlags.EnableControllers)]
|
|
[ApiController]
|
|
public class ReportingController : RepoControllerBase
|
|
{
|
|
private readonly ILandmarkReportingService _landmarkReportingService;
|
|
private readonly IAuctionReportingService _auctionReportingService;
|
|
private readonly IRepoCompanyReportingService _repoCompanyReportingService;
|
|
|
|
public ReportingController(
|
|
IHttpContextAccessor httpContextAccessor,
|
|
ILandmarkReportingService landmarkReportingService,
|
|
IAuctionReportingService auctionReportingService,
|
|
IRepoCompanyReportingService repoCompanyReportingService) :
|
|
base(httpContextAccessor)
|
|
{
|
|
_landmarkReportingService = landmarkReportingService;
|
|
_auctionReportingService = auctionReportingService;
|
|
_repoCompanyReportingService = repoCompanyReportingService;
|
|
}
|
|
|
|
// POST: api/Reporting/AuctionAssignedBalance
|
|
[HttpPost("AuctionAssignedBalance", Name = "AuctionAssignedBalance")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAuctionAssignedBalance([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results = await _auctionReportingService.GetAssignedBalance(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AuctionCountOfAssignedCollateral
|
|
[HttpPost("AuctionCountOfAssignedCollateral", Name = "AuctionCountOfAssignedCollateral")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAuctionCountOfAssignedCollateral([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results = await _auctionReportingService.GetAssignedCollateralCount(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AuctionSalePrice
|
|
[HttpPost("AuctionSalePrice", Name = "AuctionSalePrice")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAuctionSalePrice([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results = await _auctionReportingService.GetSalePriceReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AuctionTotalFees
|
|
[HttpPost("AuctionTotalFees", Name = "AuctionTotalFees")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAuctionTotalFees([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results = await _auctionReportingService.GetAuctionFeeReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AuctionAvgDaysToSold
|
|
[HttpPost("AuctionAvgDaysToSold", Name = "AuctionAvgDaysToSold")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAuctionAvgDaysToSold([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _auctionReportingService.GetAvgDaysAssignedToSold(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AuctionAvgNetOfFloor
|
|
[HttpPost("AuctionAvgNetOfFloor", Name = "AuctionAvgNetOfFloor")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAuctionAvgNetOfFloor([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _auctionReportingService.GetAvgNetOfFloor(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/RepoCompanyCountOfAssignedCollateral
|
|
[HttpPost("RepoCompanyCountOfAssignedCollateral", Name = "RepoCompanyCountOfAssignedCollateral")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetRepoCompanyCountOfAssignedCollateral([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results = await _repoCompanyReportingService.GetAssignmentCountReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/RepoCompanyAssignedBalance
|
|
[HttpPost("RepoCompanyAssignedBalance", Name = "RepoCompanyAssignedBalance")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetRepoCompanyAssignedBalance([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _repoCompanyReportingService.GetAssignedBalance(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/RepoCompanyRepoCount
|
|
[HttpPost("RepoCompanyRepoCount", Name = "RepoCompanyRepoCount")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetRepoCompanyRepoCount([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _repoCompanyReportingService.GetRepoedCountReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/RepoCompanyAvgDaysAssignedToRepo
|
|
[HttpPost("RepoCompanyAvgDaysAssignedToRepo", Name = "RepoCompanyAvgDaysAssignedToRepo")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetRepoCompanyAvgDaysAssignedToRepo([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _repoCompanyReportingService.GetAvgDaysAssignedToRepoed(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AvgDaysDlqWhenAdded
|
|
[HttpPost("AvgDaysDlqWhenAdded", Name = "AvgDaysDlqWhenAdded")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAvgDaysDlqWhenAdded([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetAvgDaysDelqWhenAddedReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AvgDaysRepoToSold
|
|
[HttpPost("AvgDaysRepoToSold", Name = "AvgDaysRepoToSold")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAvgDaysRepoToSold([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetAvgDaysRepoToSoldReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/CountOfSales
|
|
[HttpPost("CountOfSales", Name = "CountOfSales")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetCountOfSales([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetCountOfSalesReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/AvgSurplusOrDeficiency
|
|
[HttpPost("AvgSurplusOrDeficiency", Name = "AvgSurplusOrDeficiency")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetAvgSurplusOrDeficiency([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetAvgSurplusReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/CountOfRedemptions
|
|
[HttpPost("CountOfRedemptions", Name = "CountOfRedemptions")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetCountOfRedemptions([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetRedemptionCountReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/TotalRedemptionBalance
|
|
[HttpPost("TotalRedemptionBalance", Name = "TotalRedemptionBalance")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetTotalRedemptionBalance([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetRedemptionBalanceReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/LoanBalanceRepoedCollateral
|
|
[HttpPost("LoanBalanceInventory", Name = "LoanBalanceInventory")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetLoanBalanceInventory([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var result = await _landmarkReportingService.GetRepoBalanceReport(reportingRequest.LowDate, reportingRequest.HighDate);
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/IsActiveAccount
|
|
[HttpPost("IsActiveAccount", Name = "IsActiveAccount")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetIsActiveAccount([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results =
|
|
await _landmarkReportingService.GetIsActiveAccountReport(reportingRequest.LowDate,
|
|
reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
// POST: api/Reporting/IsClosedAccount
|
|
[HttpPost("IsClosedAccount", Name = "IsClosedAccount")]
|
|
[ProducesResponseType(typeof(ReportTableResponse), 200)]
|
|
[ProducesResponseType(500)]
|
|
public async Task<IActionResult> GetIsClosedAccount([FromBody] ReportingRequest reportingRequest)
|
|
{
|
|
try
|
|
{
|
|
var results =
|
|
await _landmarkReportingService.GetIsClosedAccountReport(reportingRequest.LowDate,
|
|
reportingRequest.HighDate);
|
|
return Ok(results);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Error(ex, $"Failure in {GetType().Name} at {GetInvokerAsyncMethodName()}");
|
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
}
|
|
}
|
|
|
|
}
|
|
} |