Пример #1
0
        private readonly UnitOfWork _unitOfWork;                       //工作单元事务

        /// <summary>
        /// 描述:实例化提供退班销毁课次的对象
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-9</para>
        /// </summary>
        /// <param name="tblOdrRefundOrder">退费订单主表对象</param>
        /// <param name="tblOdrLeaveClassOrder">退班表对象</param>
        /// <param name="refundEnllorCourseId">退费的课程Id集合</param>
        /// <param name="unitOfWork">工作单元事务</param>
        public LeaveClassLessonFinisher(TblOdrRefundOrder tblOdrRefundOrder, TblOdrLeaveClassOrder tblOdrLeaveClassOrder, List <long> refundEnllorCourseId, UnitOfWork unitOfWork)
        {
            _tblOdrRefundOrder     = tblOdrRefundOrder;
            _tblOdrLeaveClassOrder = tblOdrLeaveClassOrder;
            _refundEnllorCourseId  = refundEnllorCourseId;
            _unitOfWork            = unitOfWork;
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <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);
        }
Пример #4
0
        /// <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);
        }
Пример #5
0
        /// <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);
        }
        /// <summary>
        /// 余额退费办理
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2018-11-08</para>
        /// </summary>
        /// <param name="iRequest">退费订单办理数据</param>
        /// <exception cref="AMS.Core.BussinessException">
        /// 异常ID:
        /// 15. 转出余额不足
        /// 23. 该学生已经没有余额可退
        /// </exception>
        public override void Transact(IRefundOrderTransactRequest iRequest, string companyId)
        {
            var refundRequest = iRequest as BalanceRefundOrderRequest;

            //1、数据校验
            CheckBeforeTransact(refundRequest);

            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                try
                {
                    unitOfWork.BeginTransaction(System.Data.IsolationLevel.Snapshot);

                    //2、保存退费订单信息
                    var refundOrderId             = IdGenerator.NextId();
                    TblOdrRefundOrder refundOrder = AddRefundOrder(unitOfWork, refundRequest, refundOrderId).Result;

                    //3、保存余额退费的其他费用信息
                    AddRefundOrderCost(unitOfWork, refundRequest, refundOrderId);

                    //4、保存余额退费上传的附件
                    AddAttachment(unitOfWork, refundRequest.AttachmentUrlList, refundOrderId);

                    //5、保存余额退费的支付信息
                    AddRefundPay(unitOfWork, refundRequest, refundOrderId);

                    //6、资金调用
                    BalanceOrderTrade orderTrade = new BalanceOrderTrade(refundOrder, "余额退费");
                    TradeService      trade      = new TradeService(orderTrade, unitOfWork);
                    trade.Trade();

                    unitOfWork.CommitTransaction();
                }
                catch (Exception ex)
                {
                    unitOfWork.RollbackTransaction();
                    throw ex;
                }
            }
        }
        /// <summary>
        /// 保存退费订单信息
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2018-11-08</para>
        /// </summary>
        /// <param name="unitOfWork">事务单元</param>
        /// <param name="refundRequest">余额退费请求对象</param>
        /// <param name="refundOrderId">退费订单Id</param>
        /// <returns></returns>
        private async Task <TblOdrRefundOrder> AddRefundOrder(UnitOfWork unitOfWork, BalanceRefundOrderRequest refundRequest, long refundOrderId)
        {
            var rep = unitOfWork.GetCustomRepository <TblOdrRefundOrderRepository, TblOdrRefundOrder>();
            TblOdrRefundOrder refundOrder = new TblOdrRefundOrder
            {
                RefundOrderId     = refundOrderId,
                SchoolId          = this._schoolId,
                StudentId         = this._studentId,
                OrderNo           = base.CreateOrderNo(refundOrderId),
                OrderType         = (int)OrderTradeType.BalanceOrder,
                TotalDeductAmount = this.GetOtherCostAmount(refundRequest.OtherCostRequest),//扣款项统计 refundRequest.TotalDeductAmount,
                Amount            = refundRequest.RefundAmount,
                OrderStatus       = (int)OrderStatus.Paid,
                CancelUserId      = string.Empty,
                CancelDate        = null,
                CancelRemark      = string.Empty,
                CreatorId         = refundRequest.CreatorId,
                CreatorName       = refundRequest.CreatorName,
                CreateTime        = refundRequest.CreateTime
            };
            await rep.AddTask(refundOrder);

            return(refundOrder);
        }
Пример #8
0
 /// <summary>
 /// 描述:退班订单交易对象实例化
 /// <para>作    者:瞿琦</para>
 /// <para>创建时间:2018-11-10</para>
 /// </summary>
 /// <param name="refundOrder">退费订单信息</param>
 /// <param name="refundType">退款方式</param>
 public LeaveClassOrderTrade(TblOdrRefundOrder refundOrder, RefundType refundType) : base(refundOrder)
 {
     _refundType = refundType;
 }
 /// <summary>
 /// 根据转校订单对象构建一个转校订单交易对象
 /// <para>作    者:zhiwei.Tang</para>
 /// <para>创建时间:2019-02-19</para>
 /// </summary>
 /// <param name="refundOrder">转校订单对象</param>
 /// <param name="unitOfWork">工作单元</param>
 public ChangeSchoolOrderTrade(TblOdrRefundOrder refundOrder, UnitOfWork unitOfWork) : base(refundOrder)
 {
     _refundChangeSchoolOrderRepository =
         unitOfWork.GetCustomRepository <TblOdrRefundChangeSchoolOrderRepository, TblOdrRefundChangeSchoolOrder>();
 }
Пример #10
0
 /// <summary>
 /// 描述:退费订单交易类实例化
 /// <para>作    者:瞿琦</para>
 /// <para>创建时间:2019-11-5</para>
 /// </summary>
 /// <param name="refundOrder"></param>
 protected RefundOrderTrade(TblOdrRefundOrder refundOrder)
 {
     RefundOrder = refundOrder;
 }
 /// <summary>
 /// 余额订单构造函数
 /// </summary>
 /// <param name="refundOrder">余额退费对象</param>
 /// <param name="remark">订单说明</param>
 public BalanceOrderTrade(TblOdrRefundOrder refundOrder, string remark) : base(refundOrder)
 {
     this._remark = remark;
 }
        /// <summary>
        /// 描述:写入休学表详细信息表
        /// <para>作    者:瞿  琦</para>
        /// <para>创建时间:2018-12-20</para>
        /// </summary>
        /// <param name="request">要写入的休学数据</param>
        /// <param name="courseLessonList">休学课程明细</param>
        /// <param name="refundOrder">退费订单信息</param>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <returns>休学订单详情</returns>

        private TblOdrLeaveSchoolOrder AddOdrLeaveSchoolOrder(LeaveSchoolOrderAddRequest request, List <RefundOrderTransactDetailListResponse> courseLessonList, TblOdrRefundOrder refundOrder, UnitOfWork unitOfWork)
        {
            var leaveSchoolOrder = new TblOdrLeaveSchoolOrder
            {
                RefundOrderId          = refundOrder.RefundOrderId, // refundOrderId,
                SchoolId               = this._schoolId,
                LeaveTime              = request.LeaveTime,
                ResumeTime             = request.ResumeTime,
                TotalRefundLessonCount = courseLessonList.Sum(x => x.LeaveSchoolLessons),
                TotalUseLessonCount    = courseLessonList.Sum(x => x.HaveClassLesson),
                Remark = request.Remark,
                Reason = request.Reason
            };
            var tblOdrLeaveSchoolOrderRepository = unitOfWork.GetCustomRepository <TblOdrLeaveSchoolOrderRepository, TblOdrLeaveSchoolOrder>();

            tblOdrLeaveSchoolOrderRepository.Add(leaveSchoolOrder);
            return(leaveSchoolOrder);
        }
        /// <summary>
        /// 描述:写入退费订单课程明细
        /// <para>作    者:瞿  琦</para>
        /// <para>创建时间:2018-12-20</para>
        /// </summary>
        /// <param name="courseLessonList">休学课程明细</param>
        /// <param name="refundOrder">退费订单信息</param>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <returns>无</returns>
        private void AddOdrRefundOrdeEnroll(List <RefundOrderTransactDetailListResponse> courseLessonList, TblOdrRefundOrder refundOrder, UnitOfWork unitOfWork)
        {
            var refundOrdeEnrollList = new List <TblOdrRefundOrdeEnroll>();

            foreach (var item in courseLessonList)
            {
                var refundOrdeEnroll = new TblOdrRefundOrdeEnroll()    //2.退费订单课程明细
                {
                    RefundOrderEnrollId = IdGenerator.NextId(),
                    SchoolId            = base._schoolId,
                    EnrollOrderItemId   = item.EnrollOrderItemId,
                    RefundOrderId       = refundOrder.RefundOrderId,
                    LessonCount         = item.LeaveSchoolLessons,
                    UseLessonCount      = item.HaveClassLesson,
                    LessonPrice         = item.TuitionFee + item.MaterialFee,
                    Amount     = item.RefundAmount,
                    CreateTime = DateTime.Now
                };
                refundOrdeEnrollList.Add(refundOrdeEnroll);
            }
            var tblOdrRefundOrdeEnrollRepository = unitOfWork.GetCustomRepository <TblOdrRefundOrdeEnrollRepository, TblOdrRefundOrdeEnroll>();

            tblOdrRefundOrdeEnrollRepository.Add(refundOrdeEnrollList);
        }
 private const string _remark = "休学";     //备注信息
 /// <summary>
 /// 描述:休学订单交易对象实例化
 /// <para>作    者:瞿琦</para>
 /// <para>创建时间:2018-11-10</para>
 /// </summary>
 /// <param name="refundOrder">休学订单信息</param>
 public LeaveSchoolOrderTrade(TblOdrRefundOrder refundOrder) : base(refundOrder)
 {
 }
        private const string _remark = "休学";                                //备注

        /// <summary>
        /// 描述:实例化一个休学课次销毁者
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <param name="tblOdrRefundOrder">退费订单信息</param>
        /// <param name="tblOdrLeaveSchoolOrder">休学订单信息</param>
        /// <param name="unitOfWork">工作单元事务</param>
        public LeaveSchoolLessonFinisher(TblOdrRefundOrder tblOdrRefundOrder, TblOdrLeaveSchoolOrder tblOdrLeaveSchoolOrder, UnitOfWork unitOfWork)
        {
            _tblOdrRefundOrder      = tblOdrRefundOrder;
            _tblOdrLeaveSchoolOrder = tblOdrLeaveSchoolOrder;
            _unitOfWork             = unitOfWork;
        }
Пример #16
0
        /// <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);
        }