/// <summary> /// 描述:写入退费订单主表 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018-11-8</para> /// </summary> /// <param name="request">退费班级信息</param> /// <param name="courseLessonList">退费的课程</param> /// <param name="unitOfWork">事务工作单元</param> /// <returns>退费订单信息</returns> private TblOdrRefundOrder AddOdrRefundOrder(LeaveClassOrderAddRequest request, List <RefundOrderTransactDetailListResponse> courseLessonList, UnitOfWork unitOfWork) { var refundOrderId = IdGenerator.NextId(); var tblOdrRefundOrder = new TblOdrRefundOrder() //退费订单 { RefundOrderId = refundOrderId, SchoolId = base._schoolId, StudentId = base._studentId, OrderNo = base.CreateOrderNo(refundOrderId), OrderType = (int)OrderTradeType.LeaveClassOrder, TotalDeductAmount = courseLessonList.Sum(x => x.DeductAmount) + request.CostList.Sum(x => x.CostAmount), //扣款合计=已上课次费用+扣款合计 Amount = courseLessonList.Sum(x => x.RefundAmount) - request.CostList.Sum(x => x.CostAmount), //实退金额=退费金额-扣款合计 OrderStatus = request.RefundType == RefundType.RefundToParent ? (int)OrderStatus.WaitPay : (int)OrderStatus.Paid, CancelUserId = string.Empty, CancelDate = null, CancelRemark = string.Empty, CreateTime = DateTime.Now, CreatorId = request.CreatorId, CreatorName = request.CreatorName }; var tblOdrRefundOrderRepository = unitOfWork.GetCustomRepository <TblOdrRefundOrderRepository, TblOdrRefundOrder>(); tblOdrRefundOrderRepository.Add(tblOdrRefundOrder); return(tblOdrRefundOrder); }
public void Post(long studentId, [FromBody] LeaveClassOrderAddRequest request) { request.CreatorId = base.CurrentUser.UserId; request.CreatorName = base.CurrentUser.UserName; var service = new LeaveClassOrderService(base.SchoolId, studentId); service.Transact(request, base.CurrentUser.CompanyId); }
/// <summary> /// 描述:添加附件 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018-11-8</para> /// </summary> /// <param name="request">要添加的退费信息</param> /// <param name="tblOdrRefundOrder">退费订单主表信息</param> /// <param name="unitOfWork">事务工作单元</param> /// <returns>无</returns> private void AddAttachment(LeaveClassOrderAddRequest request, TblOdrRefundOrder tblOdrRefundOrder, UnitOfWork unitOfWork) { //添加上传申请表附件到数据库 foreach (var item in request.AttachmentUrlList) { item.AttchmentType = AttchmentType.LEAVE_CLASS_APPLY; item.BusinessId = tblOdrRefundOrder.RefundOrderId; } var attchmentService = new AttchmentService(base._schoolId, unitOfWork); attchmentService.Add(request.AttachmentUrlList); }
/// <summary> /// 描述:写入退班详细信息 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018-11-8</para> /// </summary> /// <param name="request">要添加的退班信息</param> /// <param name="tblOdrRefundOrder">退费订单主表信息</param> /// <param name="unitOfWork">事务工作单元</param> /// <returns>退费订单信息</returns> private TblOdrLeaveClassOrder AddOdrLeaveClassOrder(LeaveClassOrderAddRequest request, TblOdrRefundOrder tblOdrRefundOrder, UnitOfWork unitOfWork) { var tblOdrLeaveClassOrder = new TblOdrLeaveClassOrder { RefundOrderId = tblOdrRefundOrder.RefundOrderId, SchoolId = base._schoolId, StopClassDate = request.LeaveTime, Reason = request.Reason, ReceiptStatus = (int)request.ReceiptType }; var tblOdrLeaveClassOrderRepository = unitOfWork.GetCustomRepository <TblOdrLeaveClassOrderRepository, TblOdrLeaveClassOrder>(); tblOdrLeaveClassOrderRepository.Add(tblOdrLeaveClassOrder); return(tblOdrLeaveClassOrder); }
/// <summary> /// 描述:写入支付信息 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018-11-8</para> /// </summary> /// <param name="request">要添加的退班信息</param> /// <param name="tblOdrRefundOrder">退费订单主表信息</param> /// <param name="unitOfWork">事务工作单元</param> /// <returns>无</returns> private void AddOdrRefundPay(LeaveClassOrderAddRequest request, TblOdrRefundOrder tblOdrRefundOrder, UnitOfWork unitOfWork) { var odrRefundPay = new TblOdrRefundPay //退费订单 - 支付信息 { RefundPayId = IdGenerator.NextId(), RefundOrderId = tblOdrRefundOrder.RefundOrderId, SchoolId = base._schoolId, RefundType = (int)request.RefundType, Remark = request.Reason, BankName = request.BankName, BankCardNo = request.BankCardNo, BankUserName = request.BankUserName, CreateTime = DateTime.Now }; var tblOdrRefundPay = unitOfWork.GetCustomRepository <TblOdrRefundPayRepository, TblOdrRefundPay>(); tblOdrRefundPay.Add(odrRefundPay); }
/// <summary> /// 描述:写入其他费用 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018-11-8</para> /// </summary> /// <param name="request">要添加的退班信息</param> /// <param name="tblOdrRefundOrder">退费订单主表信息</param> /// <param name="unitOfWork">事务工作单元</param> /// <returns>无</returns> private void AddOdrRefundOrderCost(LeaveClassOrderAddRequest request, TblOdrRefundOrder tblOdrRefundOrder, UnitOfWork unitOfWork) { var refundOrderCostList = new List <TblOdrRefundOrderCost>(); foreach (var item in request.CostList) { var odrRefundOrderCost = new TblOdrRefundOrderCost //退费订单-其他费用 { RefundClassCostId = IdGenerator.NextId(), RefundOrderId = tblOdrRefundOrder.RefundOrderId, SchoolId = base._schoolId, CostId = item.CostId, Amount = item.CostAmount, CreateTime = DateTime.Now }; refundOrderCostList.Add(odrRefundOrderCost); } var tblOdrRefundOrderCost = unitOfWork.GetCustomRepository <TblOdrRefundOrderCostRepository, TblOdrRefundOrderCost>(); tblOdrRefundOrderCost.Add(refundOrderCostList); }