|
@@ -25,6 +25,7 @@ using OASystem.Domain.ViewModels.JuHeExchangeRate;
|
|
|
using OASystem.Domain.ViewModels.QiYeWeChat;
|
|
|
using OASystem.Domain.ViewModels.Statistics;
|
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
|
+using StackExchange.Redis;
|
|
|
using System;
|
|
|
using System.Data;
|
|
|
using TencentCloud.Ocr.V20181119.Models;
|
|
@@ -2295,7 +2296,6 @@ ORDER BY
|
|
|
return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 团组报表
|
|
|
/// 利润相关数据
|
|
@@ -7754,10 +7754,72 @@ WHERE
|
|
|
|
|
|
#region 企业利润
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 企业利润
|
|
|
+ /// Item
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("CorporateProfitExcelDownload")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> CorporateProfitItem(CorporateProfitItemDto dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ int portType = dto.PortType,
|
|
|
+ userId = dto.UserId,
|
|
|
+ pageId = dto.PageId;
|
|
|
+ #region 参数验证
|
|
|
+
|
|
|
+ var validationRules = new CorporateProfitItemDtoFoalidator();
|
|
|
+ var validResult = await validationRules.ValidateAsync(dto);
|
|
|
+ if (!validResult.IsValid)
|
|
|
+ {
|
|
|
+ var errors = new StringBuilder();
|
|
|
+ foreach (var error in validResult.Errors) errors.AppendLine(error.ErrorMessage);
|
|
|
+ return Ok(JsonView(false, errors.ToString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 页面操作权限验证
|
|
|
+ var pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(userId, pageId);
|
|
|
+
|
|
|
+ if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!"));
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ DateTime beginDt = DateTime.Parse($"{dto.BeginDt} 00:00:00"),
|
|
|
+ endDt = DateTime.Parse($"{dto.EndDt} 23:59:59");
|
|
|
+
|
|
|
+
|
|
|
+ var groupFees = await _sqlSugar
|
|
|
+ .Queryable<Grp_DelegationInfo, Sys_SetData>((gdi, ssd) => new JoinQueryInfos(JoinType.Left, gdi.TeamDid == ssd.Id))
|
|
|
+ .OrderBy((gdi, ssd) => gdi.VisitDate)
|
|
|
+ .Where((gdi, ssd) => gdi.IsDel == 0 && beginDt >= gdi.VisitDate && endDt <= gdi.VisitDate)
|
|
|
+ .Select((gdi,ssd) => new {
|
|
|
+ Id = gdi.Id,
|
|
|
+ GroupName = gdi.TeamName,
|
|
|
+ GroupTypeName = ssd.Name,
|
|
|
+ Client = gdi.ClientUnit,
|
|
|
+ VisitDate = gdi.VisitDate,
|
|
|
+ PeopleNumber = gdi.VisitPNumber,
|
|
|
+ ReceivableAmount = SqlFunc.Subqueryable<Fin_ForeignReceivables>().Where(x => x.IsDel == 0 && x.Diid == gdi.Id).Sum(x => x.ItemSumPrice * x.Rate), //应收金额
|
|
|
+ ReceivedAmount = SqlFunc.Subqueryable<Fin_ProceedsReceived>().Where(x => x.IsDel == 0 && x.Diid == gdi.Id).Sum(x => x.Price), //已收金额
|
|
|
+ //RefundedAmount = SqlFunc.Subqueryable<Fin_PaymentRefundAndOtherMoney, Grp_CreditCardPayment>((fpraom.gccp) => new JoinQueryInfos(JoinType.Inner,fpraom.id))
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(false));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 企业利润 Excel导出
|
|
|
/// </summary>
|
|
|
- /// <param name="_dto"></param>
|
|
|
+ /// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("CorporateProfitExcelDownload")]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|