|
@@ -1,10 +1,13 @@
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
+using OASystem.API.OAMethodLib.File;
|
|
using OASystem.Domain;
|
|
using OASystem.Domain;
|
|
using OASystem.Domain.Dtos.Financial;
|
|
using OASystem.Domain.Dtos.Financial;
|
|
using OASystem.Domain.Entities.Groups;
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
|
+using OASystem.Domain.ViewModels.Financial;
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
using OASystem.Infrastructure.Repositories.Financial;
|
|
using OASystem.Infrastructure.Repositories.Financial;
|
|
|
|
+using System.Data;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
namespace OASystem.API.Controllers
|
|
{
|
|
{
|
|
@@ -18,15 +21,19 @@ namespace OASystem.API.Controllers
|
|
private readonly IMapper _mapper;
|
|
private readonly IMapper _mapper;
|
|
private readonly IConfiguration _config;
|
|
private readonly IConfiguration _config;
|
|
private readonly DailyFeePaymentRepository _daiRep;
|
|
private readonly DailyFeePaymentRepository _daiRep;
|
|
|
|
+ private readonly SqlSugarClient _sqlSugar;
|
|
|
|
+ private readonly SetDataTypeRepository _setDataTypeRep;
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 初始化
|
|
/// 初始化
|
|
/// </summary>
|
|
/// </summary>
|
|
- public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep)
|
|
|
|
|
|
+ public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep)
|
|
{
|
|
{
|
|
this._mapper = mapper;
|
|
this._mapper = mapper;
|
|
this._config = configuration;
|
|
this._config = configuration;
|
|
this._daiRep = daiRep;
|
|
this._daiRep = daiRep;
|
|
|
|
+ this._sqlSugar = sqlSugar;
|
|
|
|
+ this._setDataTypeRep = setDataTypeRep;
|
|
}
|
|
}
|
|
|
|
|
|
#region 日付申请
|
|
#region 日付申请
|
|
@@ -163,6 +170,80 @@ namespace OASystem.API.Controllers
|
|
return Ok(JsonView(true));
|
|
return Ok(JsonView(true));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 日付申请 Single Excel Download
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="dto"> dto </param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpPost]
|
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
|
+ public async Task<IActionResult> PostExcelDailyPaymentDownload(SearchDailyFeePaymentDto dto)
|
|
|
|
+ {
|
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 2)
|
|
|
|
+ {
|
|
|
|
+ Fin_DailyFeePaymentInfolView feeData = new Fin_DailyFeePaymentInfolView();
|
|
|
|
+
|
|
|
|
+ string feeSql = string.Format(@"Select * From Fin_DailyFeePayment
|
|
|
|
+ Where IsDel=0 And Id = {0} ", dto.Id);
|
|
|
|
+ feeData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentInfolView>(feeSql).FirstAsync();
|
|
|
|
+ if (feeData == null)
|
|
|
|
+ {
|
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent
|
|
|
|
+ Where IsDel=0 And DFPId = {0} ", dto.Id);
|
|
|
|
+ feeData.FeeContents = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToListAsync();
|
|
|
|
+
|
|
|
|
+ if (feeData != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ string userName = string.Empty;
|
|
|
|
+ string userSql = string.Format("Select * From Sys_Users Where Id={0} And Isdel = {1}", feeData.CreateUserId, 0);
|
|
|
|
+ Sys_Users user = await _sqlSugar.SqlQueryable<Sys_Users>(userSql).FirstAsync();
|
|
|
|
+ if (user != null) { userName = user.CnName; }
|
|
|
|
+
|
|
|
|
+ var setData = _setDataTypeRep.QueryDto<Sys_SetData, Fin_DailyFeePaymentPagePriceSubTypeView>().ToList();
|
|
|
|
+ //48人员费用 49办公费用 50 销售费用 51 其他费用 55 大运会
|
|
|
|
+ var priceSubTypeData = setData.Where(s => s.STid == 55).ToList();
|
|
|
|
+
|
|
|
|
+ Dictionary<string, object> pairs = new Dictionary<string, object>();
|
|
|
|
+ List<DataTable> datas = new List<DataTable>();
|
|
|
|
+
|
|
|
|
+ //if (priceSubTypeData.Where(s => s.Id == feeData.PriceTypeId).ToList().Count() > 0)//大运会专属模板
|
|
|
|
+ //{
|
|
|
|
+
|
|
|
|
+ // //AsposeHelper.ExpertExcelToModel("日常费用付款申请模板-大运会数据.xls", "DailyPayment", "大运会所有日常费用付款申请.xls",
|
|
|
|
+ // // pairs, datas);
|
|
|
|
+ //}
|
|
|
|
+ //else //日付常规模板
|
|
|
|
+ //{
|
|
|
|
+ pairs.Clear();
|
|
|
|
+ pairs.Add("Opertor", userName);
|
|
|
|
+ pairs.Add("DateTime", feeData.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ pairs.Add("FAuditStatus", feeData.FAuditDesc);
|
|
|
|
+ pairs.Add("MAuditStatus", feeData.MAuditDesc);
|
|
|
|
+ pairs.Add("SumPrice", feeData.SumPrice);
|
|
|
|
+
|
|
|
|
+ DataTable data = AsposeHelper.ListToDataTable("DailyFeePayment", feeData.FeeContents);
|
|
|
|
+ datas.Clear();
|
|
|
|
+ datas.Add(data);
|
|
|
|
+ string fileName = string.Format("{0}-日常费用付款申请.xlsx", feeData.Instructions);
|
|
|
|
+ string msg = AsposeHelper.ExpertExcelToModel("日常费用付款申请模板.xlsx", "DailyPayment", fileName, pairs, datas);
|
|
|
|
+
|
|
|
|
+ return Ok(JsonView(true, msg));
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return Ok(JsonView(true));
|
|
|
|
+ }
|
|
#endregion
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
}
|