Example #1
0
        public async Task <IActionResult> PostOfflinePaymentAsync([FromBody] OfflinePaymentDto dto)
        {
            string OperatorOpenId = GetOpenId();

            try
            {
                var data = await _payServices.PostOfflinePaymentAsync(dto, OperatorOpenId);

                return(SuccessMsg("线下付款成功"));
            }
            catch (Exception err)
            {
                _logger.Error(typeof(WxPayController), "线下付款失败!", new Exception(err.Message));
                return(FailedMsg("线下付款失败! " + err.Message));
            }
        }
Example #2
0
        /// <summary>
        /// 线下付款
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="OperatorOpenId"></param>
        /// <returns></returns>
        public async Task <bool> PostOfflinePaymentAsync(OfflinePaymentDto dto, string OperatorOpenId)
        {
            if (dto.PaymentType != AppConsts.PaymentType.Offline)
            {
                throw new Exception("线下付款方式只能为3!");
            }

            string PayeeUserId    = string.Empty; //收款人UserId
            string OperatorUserId = string.Empty; //操作人UserId

            if (dto.PaymentType == AppConsts.PaymentType.Offline)
            {
                if (dto.ExpenseId == null)
                {
                    throw new Exception("报销单Id不能为空!");
                }

                PayeeUserId    = db.Queryable <ExpenseInfo>().Where(a => a.IsDeleted == false && a.ID == dto.ExpenseId).First()?.CreateUserId;
                OperatorUserId = db.Queryable <Wx_UserInfo>().Where(a => a.OpenId == OperatorOpenId).First()?.ID;
            }

            PaymentRecord paymentRecord = iMapper.Map <PaymentRecord>(dto);

            paymentRecord.ID             = IdHelper.CreateGuid();
            paymentRecord.ExpenseId      = dto.ExpenseId;
            paymentRecord.TeamId         = dto.TeamId;
            paymentRecord.PayeeUserId    = PayeeUserId;
            paymentRecord.OperatorUserId = OperatorUserId;
            paymentRecord.PaymentType    = dto.PaymentType;
            paymentRecord.Amount         = dto.Amount;
            paymentRecord.IsDeleted      = false;

            return(await Task.Run(() =>
            {
                var result = db.Insertable(paymentRecord).ExecuteCommand();
                if (result > 0)
                {
                    db.Updateable <ExpenseInfo>(e => e.AuditStatus == AppConsts.AuditStatus.Finished).Where(e => e.ID == dto.ExpenseId).ExecuteCommand();
                }

                return result > 0;
            }));
        }
Example #3
0
 /// <summary>
 /// 线下付款
 /// </summary>
 /// <param name="dto"></param>
 /// <param name="OperatorOpenId"></param>
 /// <returns></returns>
 public async Task <bool> PostOfflinePaymentAsync(OfflinePaymentDto dto, string OperatorOpenId)
 {
     return(await _wxpayDal.PostOfflinePaymentAsync(dto, OperatorOpenId));
 }