using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OASystem.Domain;
using OASystem.Domain.Dtos.Financial;
using OASystem.Domain.Entities.Groups;
using OASystem.Domain.ViewModels.Groups;
using OASystem.Infrastructure.Repositories.Financial;
namespace OASystem.API.Controllers
{
///
/// 财务模块
///
[Route("api/[controller]/[action]")]
[ApiController]
public class FinancialController : ControllerBase
{
private readonly IMapper _mapper;
private readonly IConfiguration _config;
private readonly DailyFeePaymentRepository _daiRep;
///
/// 初始化
///
public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep)
{
this._mapper = mapper;
this._config = configuration;
this._daiRep = daiRep;
}
#region 日付申请
///
/// 获取日付申请 基础数据源
///
/// 日付申请 分页 dto
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostPageSearchDailyPaymentPriceTypeData(DtoBase dto)
{
var result = await _daiRep.GetPagePriceTypeData(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
var data = result.Data;
return Ok(JsonView(data));
}
///
/// 日付申请 Page Search
///
/// 日付申请 分页 dto
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostPageSearchDailyPaymentList(PageDailyFeePaymentDto dto)
{
var result = await _daiRep.GetPageSearchAll(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
var data = result.Data;
if (data == null)
{
return Ok(JsonView(false, result.Msg));
}
return Ok(JsonView(data));
}
///
/// 日付申请 Single Search By Id
///
///
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostSearchDailyPaymentInfo(SearchDailyFeePaymentDto dto)
{
var result = await _daiRep.GetSearchById(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
return Ok(JsonView(result.Data));
}
///
/// 日付申请 添加
///
/// 日付申请 添加 dto
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostAddDailyPayment(AddDailyFeePaymentDto dto)
{
var result = await _daiRep.Add(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
return Ok(JsonView(true));
}
///
/// 日付申请 Update
///
/// 日付申请 修改 dto
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostEditDailyPayment(EditDailyFeePaymentDto dto)
{
var result = await _daiRep.Edit(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
return Ok(JsonView(true));
}
///
/// 日付申请 Del
///
/// 日付申请 删除 dto
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostDelDailyPayment(DelDailyFeePaymentDto dto)
{
var result = await _daiRep.Del(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
return Ok(JsonView(true));
}
///
/// 日付申请 财务审核
///
/// dto
///
[HttpPost]
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
public async Task PostDelDailyPaymentAudit(DP_AuditStatusDto dto)
{
var result = await _daiRep.DelDailyPaymentAudit(dto);
if (result == null || result.Code != 0)
{
return Ok(JsonView(false, result.Msg));
}
return Ok(JsonView(true));
}
#endregion
}
}