CostCalculationItem/IRaCIS.Core.API/Controllers/Financial/ExchangeRateController.cs

81 lines
3.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using IRaCIS.Api.Filter;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
namespace IRaCIS.Api.Controllers.Pay
{
/// <summary>
/// Financial 支撑信息---汇率
/// </summary>
[Route("exchangeRate")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Financial")]
public class ExchangeRateController : ControllerBase
{
private readonly IExchangeRateService _exchangeRateService;
private readonly ICalculateService _calculateService;
private readonly IPaymentAdjustmentService _costAdjustmentService;
public ExchangeRateController(IExchangeRateService exchangeRateService,
ICalculateService calculateService,
IPaymentAdjustmentService costAdjustmentService)
{
_exchangeRateService = exchangeRateService;
_calculateService = calculateService;
_costAdjustmentService = costAdjustmentService;
}
/// <summary>
/// 添加或更新汇率(会触发没有对锁定的费用计算)
/// </summary>
[LogFilter]
[HttpPost, Route("addOrUpdateExchangeRate")]
public IResponseOutput AddOrUpdateExchangeRate(ExchangeRateCommand addOrUpdateModel)
{
var result = _exchangeRateService.AddOrUpdateExchangeRate(addOrUpdateModel);
var calcList = _calculateService.GetNeedCalculateReviewerList(Guid.Empty, addOrUpdateModel.YearMonth);
foreach (var item in calcList)
{
if (item != null)
{
_calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
{
NeedCalculateReviewers = new List<Guid>()
{
item.DoctorId
},
CalculateMonth = DateTime.Parse(item.YearMonth)
}, User.FindFirst("id").Value);
}
}
_costAdjustmentService.CalculateCNY(addOrUpdateModel.YearMonth,addOrUpdateModel.Rate);
return result;
}
/// <summary>
/// 分页获取汇率列表
/// </summary>
[HttpPost, Route("getRateList")]
public IResponseOutput<PageOutput<ExchangeRateCommand>> GetAwardPriceList(ExchangeRateQueryDTO queryParam)
{
return ResponseOutput.Ok(_exchangeRateService.GetExchangeRateList(queryParam));
}
/// <summary>
/// 根据记录Id删除汇率记录
/// </summary>
/// <param name="id">汇率记录Id</param>
[HttpDelete, Route("deleteExchangeRate/{id:guid}")]
public IResponseOutput DeleteExchangeRate(Guid id)
{
return _exchangeRateService.DeleteExchangeRate(id);
}
}
}