|
@@ -1,4 +1,6 @@
|
|
|
-using OASystem.Domain;
|
|
|
+using AutoMapper;
|
|
|
+using OASystem.Domain;
|
|
|
+using OASystem.Domain.Dtos;
|
|
|
using OASystem.Domain.Dtos.Financial;
|
|
|
using OASystem.Domain.Dtos.UserDto;
|
|
|
using OASystem.Domain.Entities.Financial;
|
|
@@ -7,7 +9,9 @@ using OASystem.Infrastructure.Repositories.System;
|
|
|
using Org.BouncyCastle.Asn1.Cms;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.ComponentModel.Design;
|
|
|
using System.Linq;
|
|
|
+using System.Runtime.Intrinsics.Arm;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
@@ -18,19 +22,69 @@ namespace OASystem.Infrastructure.Repositories.Financial
|
|
|
/// </summary>
|
|
|
public class DailyFeePaymentRepository : BaseRepository<Fin_DailyFeePayment, Fin_DailyFeePaymentView>
|
|
|
{
|
|
|
+ private readonly IMapper _mapper;
|
|
|
private readonly System.SetDataTypeRepository _setDataTypeRep;
|
|
|
- public DailyFeePaymentRepository(SqlSugarClient sqlSugar, System.SetDataTypeRepository setDataTypeRep) :
|
|
|
- base(sqlSugar)
|
|
|
+ private readonly System.UsersRepository _UsersRep;
|
|
|
+ private readonly System.CompanyRepository _CompanyRep;
|
|
|
+
|
|
|
+ public DailyFeePaymentRepository(SqlSugarClient sqlSugar, IMapper mapper, System.SetDataTypeRepository setDataTypeRep,
|
|
|
+ UsersRepository usersRep, CompanyRepository companyRep)
|
|
|
+ : base(sqlSugar)
|
|
|
{
|
|
|
+ this._mapper = mapper;
|
|
|
this._setDataTypeRep = setDataTypeRep;
|
|
|
+ this._UsersRep = usersRep;
|
|
|
+ this._CompanyRep = companyRep;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 日付申请查询所有
|
|
|
+ /// 日付申请查询 使用的数据源
|
|
|
/// </summary>
|
|
|
- /// <param name="_loginRep"></param>
|
|
|
+ /// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<Result> GetPageSelectAll(PageDailyFeePaymentDto dto)
|
|
|
+ public async Task<Result> GetPagePriceTypeData(DtoBase dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+
|
|
|
+ dynamic? DailyFeePaymentList = null;
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 2) //web
|
|
|
+ {
|
|
|
+ var setTypeData = _setDataTypeRep.QueryDto<Sys_SetDataType, Fin_DailyFeePaymentPagePriceTypeView>().ToList();
|
|
|
+ var setData = _setDataTypeRep.QueryDto<Sys_SetData, Fin_DailyFeePaymentPagePriceSubTypeView>().ToList();
|
|
|
+
|
|
|
+ //48人员费用 49办公费用 50 销售费用 51 其他费用 55 大运会
|
|
|
+ var priceTypeData = setTypeData.Where(s => s.Id == 48 || s.Id == 49 || s.Id == 50 || s.Id == 51 || s.Id == 55).ToList();
|
|
|
+ var priceSubTypeData = setData.Where(s => s.STid == 48 || s.STid == 49 || s.STid == 50 || s.STid == 51 || s.STid == 55).ToList();
|
|
|
+ //员工姓名列表
|
|
|
+ var userNameData = await _UsersRep.GetUserNameList(dto.PortType);
|
|
|
+ //62 公转 63 私转
|
|
|
+ var feeMarkTypeData = setTypeData.Where(s => s.Id == 62 || s.Id == 63).ToList();
|
|
|
+ var feeMarkSubTypeData = setData.Where(s => s.STid == 62 || s.STid == 63).ToList();
|
|
|
+ var companyNameData = await _CompanyRep.GetCompanyNameData();
|
|
|
+ DailyFeePaymentList = new Fin_DailyFeePaymentPagePriceTypeDataView
|
|
|
+ {
|
|
|
+ FeeTypeData = priceTypeData,
|
|
|
+ FeeSubTypeData = priceSubTypeData,
|
|
|
+ UserNameData = userNameData.Data,
|
|
|
+ FeeMarkTypeData = feeMarkTypeData,
|
|
|
+ FeeMarkSubTypeData = feeMarkSubTypeData,
|
|
|
+ CompanyNameData = companyNameData.Data
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "查询成功!";
|
|
|
+ result.Data = DailyFeePaymentList;
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请 page 查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> GetPageSearchAll(PageDailyFeePaymentDto dto)
|
|
|
{
|
|
|
Result result = new Result() { Code = -2 };
|
|
|
|
|
@@ -71,7 +125,6 @@ namespace OASystem.Infrastructure.Repositories.Financial
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if (!string.IsNullOrEmpty(dto.FeeDesc))
|
|
|
sqlWhere += string.Format(" And dfp.Instructions Like '%{0}%'", dto.FeeDesc);
|
|
@@ -112,7 +165,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
|
|
|
|
|
|
int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
|
|
|
int endIndex = startIndex + dto.PageSize;
|
|
|
-
|
|
|
+
|
|
|
DailyFeePaymentList = new Fin_DailyFeePaymentPage
|
|
|
{
|
|
|
Rows = totalCount,
|
|
@@ -127,5 +180,174 @@ namespace OASystem.Infrastructure.Repositories.Financial
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请 single 查询 By Id
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> GetSearchById(SearchDailyFeePaymentDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+
|
|
|
+ Fin_DailyFeePaymentInfolView feeData = new Fin_DailyFeePaymentInfolView();
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 2) //web
|
|
|
+ {
|
|
|
+ string feeSql = string.Format(@"Select * From Fin_DailyFeePayment
|
|
|
+ Where IsDel=0 And Id = {0} ", dto.Id);
|
|
|
+ feeData = await _sqlSugar.SqlQueryable<Fin_DailyFeePaymentInfolView>(feeSql).FirstAsync();
|
|
|
+ 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();
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "查询成功!";
|
|
|
+ result.Data = feeData;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请 添加
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> Add(AddDailyFeePaymentDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+ _sqlSugar.BeginTran();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Fin_DailyFeePayment _fee = _mapper.Map<Fin_DailyFeePayment>(dto);
|
|
|
+ _fee.CreateUserId = dto.UserId;
|
|
|
+ int? feeId = await _sqlSugar.Insertable(_fee).ExecuteReturnIdentityAsync();
|
|
|
+
|
|
|
+ List<Fin_DailyFeePaymentContent> _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
|
|
|
+
|
|
|
+ foreach (var item in _feeContents)
|
|
|
+ {
|
|
|
+ item.DFPId = feeId == null ? -1 : Convert.ToInt32(feeId);
|
|
|
+ item.CreateUserId = dto.UserId;
|
|
|
+ }
|
|
|
+ await _sqlSugar.Insertable(_feeContents).ExecuteCommandAsync();
|
|
|
+ _sqlSugar.CommitTran();
|
|
|
+ result.Code = 0;
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ result.Msg = ex.Message;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请 编辑
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> Edit(EditDailyFeePaymentDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+ _sqlSugar.BeginTran();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Fin_DailyFeePayment _fee = _mapper.Map<Fin_DailyFeePayment>(dto);
|
|
|
+ _fee.CreateUserId = dto.UserId;
|
|
|
+ int? editFeeStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
|
|
|
+ .Where(a => a.Id == dto.Id)
|
|
|
+ .SetColumns(a => new Fin_DailyFeePayment
|
|
|
+ {
|
|
|
+ Instructions = dto.Instructions,
|
|
|
+ SumPrice = dto.SumPrice,
|
|
|
+ TransferTypeId = dto.TransferTypeId,
|
|
|
+ PriceTypeId = dto.PriceTypeId,
|
|
|
+ CompanyId = dto.CompanyId,
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
+
|
|
|
+ List<Fin_DailyFeePaymentContent> _feeContents = _mapper.Map<List<Fin_DailyFeePaymentContent>>(dto.FeeContents);
|
|
|
+
|
|
|
+ int? editFeeContsStatus = await _sqlSugar.Updateable(_feeContents)
|
|
|
+ .UpdateColumns(a => new { a.PriceName, a.Price, a.Quantity, a.ItemTotal, a.Remark })
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ _sqlSugar.CommitTran();
|
|
|
+ result.Code = 0;
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ result.Msg = ex.Message;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请 删除
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> Del(DelDailyFeePaymentDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+
|
|
|
+ int? delFeeStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
|
|
|
+ .Where(a => a.Id == dto.Id)
|
|
|
+ .SetColumns(a => new Fin_DailyFeePayment
|
|
|
+ {
|
|
|
+ IsDel =1,
|
|
|
+ DeleteUserId = dto.Id,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 日付申请 审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> DelDailyPaymentAudit(DP_AuditStatusDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2 };
|
|
|
+
|
|
|
+ if (dto.AuditType == 1) //财务审核
|
|
|
+ {
|
|
|
+ int? auditStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
|
|
|
+ .Where(a => a.Id == dto.Id)
|
|
|
+ .SetColumns(a => new Fin_DailyFeePayment
|
|
|
+ {
|
|
|
+ FAudit = dto.AuditStatus,
|
|
|
+ FAuditDate = DateTime.Now,
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
+ if (auditStatus != null && auditStatus > 0)
|
|
|
+ result.Code = 0;
|
|
|
+ else
|
|
|
+ result.Msg = "财务审核操作失败";
|
|
|
+ }
|
|
|
+ else if (dto.AuditType == 2) //总经理
|
|
|
+ {
|
|
|
+ int? auditStatus = await _sqlSugar.Updateable<Fin_DailyFeePayment>()
|
|
|
+ .Where(a => a.Id == dto.Id)
|
|
|
+ .SetColumns(a => new Fin_DailyFeePayment
|
|
|
+ {
|
|
|
+ MAudit = dto.AuditStatus,
|
|
|
+ MAuditDate = DateTime.Now,
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
+
|
|
|
+ if (auditStatus != null && auditStatus > 0)
|
|
|
+ result.Code = 0;
|
|
|
+ else
|
|
|
+ result.Msg = "总经理审核操作失败";
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
}
|