1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309 |
- using Aspose.Cells;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using OASystem.API.OAMethodLib;
- using OASystem.API.OAMethodLib.File;
- using OASystem.Domain;
- using OASystem.Domain.Dtos.Financial;
- using OASystem.Domain.Dtos.Groups;
- using OASystem.Domain.Entities.Financial;
- using OASystem.Domain.Entities.Groups;
- using OASystem.Domain.ViewModels.Financial;
- using OASystem.Domain.ViewModels.Groups;
- using OASystem.Domain.ViewModels.SmallFun;
- using OASystem.Infrastructure.Repositories.Financial;
- using OASystem.Infrastructure.Repositories.Groups;
- using SqlSugar;
- using StackExchange.Redis;
- using System.Data;
- namespace OASystem.API.Controllers
- {
-
-
-
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class FinancialController : ControllerBase
- {
- private readonly IMapper _mapper;
- private readonly IConfiguration _config;
- private readonly SqlSugarClient _sqlSugar;
- private readonly SetDataTypeRepository _setDataTypeRep;
- private readonly DailyFeePaymentRepository _daiRep;
- private readonly TeamRateRepository _teamRateRep;
- private readonly ForeignReceivablesRepository _ForForeignReceivablesRep;
- private readonly ProceedsReceivedRepository _proceedsReceivedRep;
- private readonly PaymentRefundAndOtherMoneyRepository _paymentRefundAndOtherMoneyRep;
-
-
-
- public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep,
- TeamRateRepository teamRateRep, ForeignReceivablesRepository ForForeignReceivablesRep, ProceedsReceivedRepository proceedsReceivedRep,
- PaymentRefundAndOtherMoneyRepository paymentRefundAndOtherMoneyRep)
- {
- _mapper = mapper;
- _config = configuration;
- _daiRep = daiRep;
- _sqlSugar = sqlSugar;
- _setDataTypeRep = setDataTypeRep;
- _teamRateRep = teamRateRep;
- _ForForeignReceivablesRep = ForForeignReceivablesRep;
- _proceedsReceivedRep = proceedsReceivedRep;
- _paymentRefundAndOtherMoneyRep = paymentRefundAndOtherMoneyRep;
- }
- #region 日付申请
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPageSearchDailyPaymentPriceTypeData(PortDtoBase 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));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> GetSearchDailyPaymentPriceTypeAddData(PortDtoBase dto)
- {
- var result = await _daiRep.GetPriceTypeAddData(dto);
- if (result == null || result.Code != 0)
- {
- return Ok(JsonView(false, result.Msg));
- }
- var data = result.Data;
- return Ok(JsonView(data));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> 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));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> 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));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> 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));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> 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));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> 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));
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> 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));
- }
-
-
-
-
-
- [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();
-
- var priceSubTypeData = setData.Where(s => s.STid == 55).ToList();
- Dictionary<string, object> pairs = new Dictionary<string, object>();
- List<DataTable> datas = new List<DataTable>();
-
-
-
-
-
-
-
- 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
- #region 团组提成
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPageSearchCommissionList(GroupCommissionDto dto)
- {
- var data = await GroupCommission.GetCommissionPageList(dto);
- return Ok(JsonView(data.Data));
- }
- #endregion
- #region 团组汇率
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> GetGroupRateDataSources(TeamRateDto dto)
- {
- try
- {
- Result teamRateData = await _teamRateRep.GetGroupRateDataSource(dto);
- if (teamRateData.Code != 0)
- {
- return Ok(JsonView(false, teamRateData.Msg));
- }
- return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> GetGroupRateInfo(TeamRateInfoDto dto)
- {
- try
- {
- Result teamRateData = await _teamRateRep.GetGroupRateInfoByDiid(dto);
- if (teamRateData.Code != 0)
- {
- return Ok(JsonView(false, teamRateData.Msg));
- }
- return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostGroupRateUpdate(TeamRateUpdateDto dto)
- {
- try
- {
- Result teamRateData = await _teamRateRep.PostGroupRateUpdate(dto);
- if (teamRateData.Code != 0)
- {
- return Ok(JsonView(false, teamRateData.Msg));
- }
- return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
- #endregion
- #region 对外收款账单 关联已收款项
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> GetForeignReceivablesDataSources()
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.GetDataSource();
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> GetGroupReceivablesInfoByDiId(ForForeignReceivablesInfoDto dto)
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.GetGroupReceivablesInfoByDiId(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostGroupReceivablesDel(DelForForeignReceivablesInfoDto dto)
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep._Del(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostReceivablesOperate(ForeignReceivablesAddAndUpdateDto dto)
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.PostReceivablesOperate(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostAmountReceivedDel(ProceedsReceivedDelDto dto)
- {
- try
- {
- Result ffrData = await _proceedsReceivedRep._Del(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostAmountReceivedOperate(ProceedsReceivedDto dto)
- {
- try
- {
- Result ffrData = await _proceedsReceivedRep.PostAmountReceivedOperate(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostAllocateAmountReceived(AllocateAmountReceivedDto dto)
- {
- try
- {
- Result ffrData = await _proceedsReceivedRep.PostAllocateAmountReceived(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #endregion
- #region 对外收款账单
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostGroupReceivablesDataSource()
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.PostDataSource();
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.PostGroupReceivablesInfoByDiId(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostReceivablesSave(ForeignReceivablesSaveDto dto)
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.PostReceivablesSave(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostReceivablesDel(ForeignReceivablesDelDto dto)
- {
- try
- {
- Result ffrData = await _ForForeignReceivablesRep.PostReceivablesDel(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- throw;
- }
- }
- #endregion
- #region 已收款项
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostAmountReceived(AmountReceivedDto dto)
- {
- try
- {
- if (dto == null)
- {
- return Ok(JsonView(false, "参数不能为空!"));
- }
- Result ffrData = await _proceedsReceivedRep.PostAmountReceived(dto.DiId);
- dynamic data = null;
- if (dto.PortType == 1)
- {
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- data = ffrData.Data;
- }
- else if (dto.PortType == 2)
- {
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- data = ffrData.Data;
- }
- else if (dto.PortType == 2)
- {
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- data = ffrData.Data;
- }
- else
- {
- return Ok(JsonView(false, "请选择正确的端口号!"));
- }
- return Ok(JsonView(true, "操作成功!", data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostAmountReceivedAddOrEdit(AmountReceivedAddOrEditDto dto)
- {
- try
- {
- if (dto == null)
- {
- return Ok(JsonView(false, "参数不能为空!"));
- }
- Result ffrData = await _proceedsReceivedRep.PostAmountReceivedAddOrEditDto(dto);
- if (dto.PortType == 1)
- {
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- }
- else if (dto.PortType == 2)
- {
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- }
- else if (dto.PortType == 2)
- {
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- }
- else
- {
- return Ok(JsonView(false, "请选择正确的端口号!"));
- }
- return Ok(JsonView(true, "操作成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostAmountReceived_Del(AmountReceivedDelDto dto)
- {
- try
- {
- if (dto == null)
- {
- return Ok(JsonView(false, "参数不能为空!"));
- }
- Result ffrData = await _proceedsReceivedRep.PostAmountReceivedDel(dto);
- if (ffrData.Code != 0)
- {
- return Ok(JsonView(false, ffrData.Msg));
- }
- return Ok(JsonView(true, "操作成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
- #endregion
- #region 收款退还与其他款项
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPaymentRefundAndOtherMoneyItemByDiId(PaymentRefundAndOtherMoneyItemByDiIdDto dto)
- {
- try
- {
- if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
- if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
- if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
- #region 页面功能权限处理
- PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
- pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
- if (pageFunAuth.CheckAuth == 0)
- {
- return Ok(JsonView(false, "您没有当前页面查询权限!"));
- }
- #endregion
- Result _result = await _paymentRefundAndOtherMoneyRep._ItemByDiId(dto.DiId);
- if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)
- {
- if (_result.Code != 0)
- {
- return Ok(JsonView(false, _result.Msg));
- }
- var data = new
- {
- PageFuncAuth = pageFunAuth,
- Data = _result.Data
- };
- return Ok(JsonView(true, "操作成功!", data));
- }
- else
- {
- return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
- }
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPaymentRefundAndOtherMoneyDel(PaymentRefundAndOtherMoneyDelDto dto)
- {
- try
- {
- if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
- if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
- if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
- PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
- #region 页面功能权限处理
- pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
- #endregion
- if (pageFunAuth.DeleteAuth == 0)
- {
- return Ok(JsonView(false, "您没有当前页面删除权限!"));
- }
- Result _result = await _paymentRefundAndOtherMoneyRep._Del(dto);
- if (_result.Code != 0)
- {
- return Ok(JsonView(false, _result.Msg));
- }
- return Ok(JsonView(true, "操作成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfoDataSource(PortDtoBase dto)
- {
- try
- {
- Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
- if (_result.Code != 0)
- {
- return Ok(JsonView(false, _result.Msg));
- }
- return Ok(JsonView(true, "查询成功!", _result.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfo(PaymentRefundAndOtherMoneyInfoDto dto)
- {
- try
- {
- if (dto == null)
- {
- return Ok(JsonView(false, "参数不能为空!"));
- }
- Result _result = await _paymentRefundAndOtherMoneyRep._Info(dto);
- if (_result.Code != 0)
- {
- return Ok(JsonView(false, _result.Msg));
- }
- return Ok(JsonView(true, "查询成功!", _result.Data));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostPaymentRefundAndOtherMoneyAddOrEdit(PaymentRefundAndOtherMoneyAddOrEditDto dto)
- {
- try
- {
- if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
- if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
- if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
- #region 页面功能权限处理
- PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
- pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
- #endregion
- if (dto.Status == 1)
- {
- if (pageFunAuth.AddAuth == 0)
- {
- return Ok(JsonView(false, "您没有当前页面添加权限!"));
- }
- }
- else if (dto.Status == 2)
- {
- if (pageFunAuth.EditAuth == 0)
- {
- return Ok(JsonView(false, "您没有当前页面编辑权限!"));
- }
- }
- else
- {
- return Ok(JsonView(false, "请输入正确的操作状态! 1 添加 2 修改!"));
- }
- Result _result = await _paymentRefundAndOtherMoneyRep._AddOrEdit(dto);
- if (_result.Code != 0)
- {
- return Ok(JsonView(false, _result.Msg));
- }
- return Ok(JsonView(true, "操作成功!"));
- }
- catch (Exception ex)
- {
- return Ok(JsonView(false, ex.Message));
- }
- }
- #endregion
- #region 应收报表
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [HttpPost]
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
- public async Task<IActionResult> PostSyntheticalReceivableByDateRange(PostSyntheticalReceivableByDateRangeDto dto)
- {
- string sqlWhere = " Where di.IsDel=0 ";
- #region 验证
- if (string.IsNullOrEmpty(dto.beginDt) && string.IsNullOrEmpty(dto.endDt))
- {
- return Ok(JsonView(false, "日期参数至少填写一个!"));
- }
- if (!string.IsNullOrEmpty(dto.beginDt))
- {
- if (Regex.Match(dto.beginDt, @"^\d{4}-\d{2}-\d{2}$").Value.Length < 1)
- {
- return Ok(JsonView(false, "日期参数格式错误,应为yyyy-MM-dd!"));
- }
- else
- {
- sqlWhere += string.Format(@" And di.VisitDate >= '{0}' ", dto.beginDt);
- }
- }
- if (!string.IsNullOrEmpty(dto.endDt))
- {
- if (Regex.Match(dto.endDt, @"^\d{4}-\d{2}-\d{2}$").Value.Length < 1)
- {
- return Ok(JsonView(false, "日期参数格式错误,应为yyyy-MM-dd!"));
- }
- else
- {
- sqlWhere += string.Format(@" And di.VisitDate <= '{0}' ", dto.endDt);
- }
- }
- #endregion
- string sql = string.Format(@" select distinct fr.diid,di.TeamName,di.ClientUnit,di.VisitDate from Fin_ForeignReceivables fr join Grp_DelegationInfo di on fr.DIID = di.id {0} ", sqlWhere);
- List<PostSyntheticalReceivableByDateRangeView> list_rst = _sqlSugar.SqlQueryable<PostSyntheticalReceivableByDateRangeView>(sql).ToList();
- decimal sumAll_fr = 0M;
- decimal sumAll_pr = 0M;
- decimal sumAll_balance = 0M;
- if (list_rst.Count > 0)
- {
- int rowNumber = 1;
- foreach (var item_rst in list_rst)
- {
- item_rst.No = rowNumber;
- rowNumber++;
- int diId = item_rst.diid;
- decimal sum_fr = 0M;
- decimal sum_pr = 0M;
- string str_client = string.Empty;
- decimal sum_other = 0M;
- decimal balance = 0M;
- string str_schedule = string.Empty;
-
- string sql_fr = string.Format(@" Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0} ", diId);
- List<Fin_ForeignReceivables> list_fr = _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql_fr).ToList();
- sum_fr = list_fr.Sum(s => s.ItemSumPrice);
-
- string sql_pr = string.Format(@" Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0} ", diId);
- List<Fin_ProceedsReceived> list_pr = _sqlSugar.SqlQueryable<Fin_ProceedsReceived>(sql_pr).ToList();
- foreach (var item_pr in list_pr)
- {
- sum_pr += item_pr.Price;
- str_client += string.Format(@"{0};", item_pr.Client);
- str_schedule += string.Format(@"{0};", item_pr.Remark);
- }
- if (str_schedule.Length > 0)
- {
- str_schedule = str_schedule.TrimEnd(';');
- }
- if (str_client.Length > 0)
- {
- str_client = str_client.TrimEnd(';');
- }
-
- string sql_other = string.Format(@" Select * From Fin_OtherPrice where diid = {0} and isdel = 0 and RefundType = 1 and PayType=1 ", diId);
- List<Fin_OtherPrice> list_other = _sqlSugar.SqlQueryable<Fin_OtherPrice>(sql_other).ToList();
- sum_other = list_other.Sum(s => s.Price);
- item_rst.frPrice = sum_fr.ToString("#0.00");
- item_rst.prPrice = (sum_pr - sum_other).ToString("#0.00");
- item_rst.balPrice = (sum_fr - (sum_pr - sum_other)).ToString("#0.00");
- item_rst.clientUnit = str_client;
- item_rst.schedule = str_schedule;
- sumAll_fr += sum_fr;
- sumAll_pr += (sum_pr - sum_other);
- sumAll_balance += (sum_fr - (sum_pr - sum_other));
- }
- PostSyntheticalReceivableByDateRangeResultView result = new PostSyntheticalReceivableByDateRangeResultView();
- result.total_fr = sumAll_fr.ToString("#0.00");
- result.total_pr = sumAll_pr.ToString("#0.00");
- result.total_balance = sumAll_balance.ToString("#0.00");
- result.dataList = new List<PostSyntheticalReceivableByDateRangeView>(list_rst);
- if (dto.requestType == 1)
- {
- return Ok(JsonView(true, "请求成功", result, list_rst.Count));
- }
- else {
-
- List<Excel_SyntheticalReceivableByDateRange> list_Ex = new List<Excel_SyntheticalReceivableByDateRange>();
- WorkbookDesigner designer = new WorkbookDesigner();
- designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/应收款项模板 - 副本.xls");
- int excNo = 1;
- foreach (var item in list_rst)
- {
- Excel_SyntheticalReceivableByDateRange exc = new Excel_SyntheticalReceivableByDateRange();
- exc.No = excNo.ToString();
- excNo++;
- exc.TeamName = item.teamName;
- exc.ClientUnit = item.clientUnit;
- exc.VisitDate = item.visitDate;
- exc.Accounts = item.frPrice;
- exc.Received = item.prPrice;
- exc.Balance = item.balPrice;
- exc.Collection = item.schedule;
- DateTime time = Convert.ToDateTime(item.visitDate);
- TimeSpan ts = DateTime.Now - time;
- float SY = float.Parse(item.balPrice);
- if (ts.Days >= 365 && SY > 0)
- {
- exc.Sign = "需收款";
- }
- else
- {
- exc.Sign = "";
- }
- list_Ex.Add(exc);
- }
- var dt = CommonFun.GetDataTableFromIList(list_Ex);
- dt.TableName = "Excel_SyntheticalReceivableByDateRange";
- if (dt != null)
- {
- designer.SetDataSource("SumPrice", "应收合计:" + result.total_fr + "RMB 已收合计:" + result.total_pr + "RMB 余款合计:" + result.total_balance + "RMB");
-
- designer.SetDataSource(dt);
-
- designer.Process();
- string fileName = ("Receivable/应收款项(" + dto.beginDt + "~" + dto.endDt + ").xlsx");
- designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName);
- string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
- return Ok(JsonView(true, "成功", new { url = rst }));
- }
- }
-
- }
- return Ok(JsonView(true, "获取成功", "", list_rst.Count));
- }
- #endregion
- }
- }
|