|
@@ -0,0 +1,131 @@
|
|
|
+using OASystem.Domain;
|
|
|
+using OASystem.Domain.Dtos.Financial;
|
|
|
+using OASystem.Domain.Dtos.UserDto;
|
|
|
+using OASystem.Domain.Entities.Financial;
|
|
|
+using OASystem.Domain.ViewModels.Financial;
|
|
|
+using OASystem.Infrastructure.Repositories.System;
|
|
|
+using Org.BouncyCastle.Asn1.Cms;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace OASystem.Infrastructure.Repositories.Financial
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 财务 - 日付申请
|
|
|
+ /// </summary>
|
|
|
+ public class DailyFeePaymentRepository : BaseRepository<Fin_DailyFeePayment, Fin_DailyFeePaymentView>
|
|
|
+ {
|
|
|
+ private readonly System.SetDataTypeRepository _setDataTypeRep;
|
|
|
+ public DailyFeePaymentRepository(SqlSugarClient sqlSugar, System.SetDataTypeRepository setDataTypeRep) :
|
|
|
+ base(sqlSugar)
|
|
|
+ {
|
|
|
+ this._setDataTypeRep = setDataTypeRep;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请查询所有
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_loginRep"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> GetPageSelectAll(PageDailyFeePaymentDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+
|
|
|
+ #region sql条件处理
|
|
|
+ string sqlWhere = "";
|
|
|
+
|
|
|
+ if (dto.CompanyId != -1) //公司
|
|
|
+ sqlWhere += string.Format(" And dfp.CompanyId = {0}", dto.CompanyId);
|
|
|
+
|
|
|
+ if (dto.FinancialAuditStatus != -1) //财务审核
|
|
|
+ sqlWhere += string.Format(" And dfp.FAudit = {0}", dto.FinancialAuditStatus);
|
|
|
+
|
|
|
+ if (dto.ManagerAuditStatus != -1) //总经理审核
|
|
|
+ sqlWhere += string.Format(" And dfp.MAudit = {0}", dto.ManagerAuditStatus);
|
|
|
+
|
|
|
+ if (dto.FeeTypeId != -1) //费用类型
|
|
|
+ {
|
|
|
+ if (dto.FeeSubTypeId != -1) //子类处理
|
|
|
+ {
|
|
|
+ sqlWhere += string.Format(" And dfp.PriceTypeId = {0}", dto.FeeSubTypeId);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var setData = _setDataTypeRep.QueryDto<Sys_SetData, SetDataView>(s => s.STid == dto.FeeTypeId).ToList();
|
|
|
+ if (setData.Count > 0)
|
|
|
+ {
|
|
|
+ string setDataIds = "";
|
|
|
+ foreach (var item in setData)
|
|
|
+ {
|
|
|
+ setDataIds += item.Id + ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (setDataIds.Length > 0)
|
|
|
+ {
|
|
|
+ setDataIds = setDataIds.Substring(1, setDataIds.Length - 2);
|
|
|
+ sqlWhere += string.Format(" And dfp.PriceTypeId In ({0})", setDataIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(dto.FeeDesc))
|
|
|
+ sqlWhere += string.Format(" And dfp.Instructions Like '%{0}%'", dto.FeeDesc);
|
|
|
+
|
|
|
+ if (dto.CreateUserId != -1)
|
|
|
+ sqlWhere += string.Format(" And dfp.CreateUserId = {0}", dto.CreateUserId);
|
|
|
+
|
|
|
+ //string sqlPage = string.Format(@"Select * From (
|
|
|
+ // Select row_number() over (order by dfp.Id Desc) as RowNumber,
|
|
|
+ // dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
|
|
|
+ // dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
|
|
|
+ // dfp.PriceTypeId
|
|
|
+ // From Fin_DailyFeePayment dfp
|
|
|
+ // Inner Join Sys_Company c On dfp.CompanyId = c.Id
|
|
|
+ // Left Join Sys_Users u On dfp.CreateUserId = u.Id
|
|
|
+ // Where dfp.IsDel=0 {0}
|
|
|
+ // ) temp Where RowNumber Between {1} and {2} ", sqlWhere, dto.PageIndex, dto.PageSize);
|
|
|
+
|
|
|
+
|
|
|
+ string sqlPage = string.Format(@"Select * From (
|
|
|
+ Select row_number() over (order by dfp.Id Desc) as RowNumber,
|
|
|
+ dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
|
|
|
+ dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
|
|
|
+ dfp.PriceTypeId
|
|
|
+ From Fin_DailyFeePayment dfp
|
|
|
+ Inner Join Sys_Company c On dfp.CompanyId = c.Id
|
|
|
+ Left Join Sys_Users u On dfp.CreateUserId = u.Id
|
|
|
+ Where dfp.IsDel=0 {0}
|
|
|
+ ) temp ", sqlWhere);
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ dynamic? DailyFeePaymentList = null;
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 2) //web
|
|
|
+ {
|
|
|
+ var DailyFeePaymentData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentPageListView>(sqlPage).ToListAsync();
|
|
|
+
|
|
|
+ int totalCount = DailyFeePaymentData.Count;
|
|
|
+
|
|
|
+ int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
|
|
|
+ int endIndex = startIndex + dto.PageSize;
|
|
|
+
|
|
|
+ DailyFeePaymentList = new Fin_DailyFeePaymentPage
|
|
|
+ {
|
|
|
+ Rows = totalCount,
|
|
|
+ Data = DailyFeePaymentData.Where(a => a.RowNumber >= startIndex && a.RowNumber < endIndex).ToList()
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "查询成功!";
|
|
|
+ result.Data = DailyFeePaymentList;
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|