private GetBuilder <ApplyWithdrawInfo> WhereBuilder(ApplyWithDrawQuery query) { var db = DbFactory.Default.Get <ApplyWithdrawInfo>(); if (query.MemberId.HasValue) { db.Where(e => e.MemId == query.MemberId); } if (query.WithDrawNo.HasValue) { db.Where(e => e.Id == query.WithDrawNo); } if (query.withDrawStatus.HasValue && query.withDrawStatus.Value > 0) { db.Where(e => e.ApplyStatus == query.withDrawStatus.Value); } if (query.ApplyType.HasValue) { db.Where(e => e.ApplyType == query.ApplyType.Value); } return(db); }
public ObsoletePageModel <ApplyWithDrawInfo> GetApplyWithDraw(ApplyWithDrawQuery query) { var withDraw = Context.ApplyWithDrawInfo.AsQueryable(); if (query.memberId.HasValue) { withDraw = withDraw.Where(e => e.MemId == query.memberId); } if (query.withDrawNo.HasValue) { withDraw = withDraw.Where(e => e.Id == query.withDrawNo); } if (query.withDrawStatus.HasValue && query.withDrawStatus.Value != 0) { withDraw = withDraw.Where(e => e.ApplyStatus == query.withDrawStatus.Value); } int total = 0; var model = withDraw; if (string.IsNullOrWhiteSpace(query.Sort)) { model = withDraw.GetPage(out total, query.PageNo, query.PageSize, p => p.OrderBy(e => e.ApplyStatus).ThenByDescending(e => e.ApplyTime)); } else { model = withDraw.GetPage(out total, query.PageNo, query.PageSize, p => p.OrderByDescending(e => e.ApplyTime)); } ObsoletePageModel <ApplyWithDrawInfo> result = new ObsoletePageModel <ApplyWithDrawInfo> { Models = model, Total = total }; return(result); }
public JsonResult ApplyWithDrawList(ApplyWithDrawInfo.ApplyWithDrawStatus capitalType, string withdrawno, string user, int page, int rows) { IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>(); IMemberService memberService = ServiceHelper.Create <IMemberService>(); long?nullable = null; if (!string.IsNullOrWhiteSpace(user)) { nullable = new long?((memberService.GetMemberByName(user) ?? new UserMemberInfo() { Id = 0 }).Id); } ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery() { memberId = nullable, PageSize = rows, PageNo = page, withDrawStatus = new ApplyWithDrawInfo.ApplyWithDrawStatus?(capitalType) }; ApplyWithDrawQuery nullable1 = applyWithDrawQuery; if (!string.IsNullOrWhiteSpace(withdrawno)) { nullable1.withDrawNo = new long?(long.Parse(withdrawno)); } PageModel <ApplyWithDrawInfo> applyWithDraw = memberCapitalService.GetApplyWithDraw(nullable1); IEnumerable <ApplyWithDrawModel> applyWithDrawModels = applyWithDraw.Models.ToList().Select <ApplyWithDrawInfo, ApplyWithDrawModel>((ApplyWithDrawInfo e) => { string description = e.ApplyStatus.ToDescription(); UserMemberInfo member = memberService.GetMember(e.MemId); return(new ApplyWithDrawModel() { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = description, ApplyTime = e.ApplyTime.ToString(), NickName = e.NickName, MemberName = member.UserName, ConfirmTime = e.ConfirmTime.ToString(), MemId = e.MemId, OpUser = e.OpUser, PayNo = e.PayNo, PayTime = e.PayTime.ToString(), Remark = e.Remark, WithdrawType = e.WithdrawType, Myaccount = e.Myaccount, UserInfo = e.Myaccount + '(' + e.NickName + ')' }); }); DataGridModel <ApplyWithDrawModel> dataGridModel = new DataGridModel <ApplyWithDrawModel>() { rows = applyWithDrawModels, total = applyWithDraw.Total }; return(Json(dataGridModel)); }
public JsonResult ApplyWithDrawList(Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus capitalType, Himall.CommonModel.UserWithdrawType?applyType, string withdrawno, string user, int page, int rows) { var capitalService = _iMemberCapitalService; var memberService = _iMemberService; long?membid = null; if (!string.IsNullOrWhiteSpace(user)) { var memberInfo = memberService.GetMemberByName(user) ?? new Entities.MemberInfo() { Id = 0 }; membid = memberInfo.Id; } var query = new ApplyWithDrawQuery { MemberId = membid, ApplyType = applyType, PageSize = rows, PageNo = page, withDrawStatus = capitalType }; if (!string.IsNullOrWhiteSpace(withdrawno)) { query.WithDrawNo = long.Parse(withdrawno); } var pageMode = capitalService.GetApplyWithDraw(query); var model = pageMode.Models.ToList().Select(e => { string applyStatus = e.ApplyStatus.ToDescription(); var mem = memberService.GetMember(e.MemId); return(new ApplyWithDrawModel { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = applyStatus, ApplyTime = e.ApplyTime.ToString(), NickName = e.NickName, MemberName = mem.UserName, ConfirmTime = e.ConfirmTime.ToString(), MemId = e.MemId, OpUser = e.OpUser, PayNo = e.PayNo, PayTime = e.PayTime.ToString(), Remark = string.IsNullOrEmpty(e.Remark) ? string.Empty : e.Remark }); }); var models = new DataGridModel <ApplyWithDrawModel> { rows = model, total = pageMode.Total }; return(Json(models)); }
public JsonResult ApplyWithDrawList(int page, int rows) { var capitalService = _iMemberCapitalService; var query = new ApplyWithDrawQuery { MemberId = CurrentUser.Id, PageSize = rows, PageNo = page, Sort = "ApplyTime" }; var pageMode = capitalService.GetApplyWithDraw(query); var model = pageMode.Models.ToList().Select(e => { string applyStatus = string.Empty; if (e.ApplyStatus == Mall.Entities.ApplyWithdrawInfo.ApplyWithdrawStatus.PayFail || e.ApplyStatus == Mall.Entities.ApplyWithdrawInfo.ApplyWithdrawStatus.WaitConfirm ) { applyStatus = "提现中"; } else if (e.ApplyStatus == Mall.Entities.ApplyWithdrawInfo.ApplyWithdrawStatus.Refuse) { applyStatus = "提现失败"; } else if (e.ApplyStatus == Mall.Entities.ApplyWithdrawInfo.ApplyWithdrawStatus.WithDrawSuccess) { applyStatus = "提现成功"; } else { applyStatus = e.ApplyStatus.ToDescription(); } return(new DTO.ApplyWithDrawModel { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = applyStatus, ApplyTime = e.ApplyTime.ToString(), Remark = e.Remark }); }); var models = new DataGridModel <DTO.ApplyWithDrawModel> { rows = model, total = pageMode.Total }; return(Json(models)); }
public JsonResult ApplyWithDrawListByUser(long userid, Himall.CommonModel.UserWithdrawType?applyType, int page, int rows) { var capitalService = _iMemberCapitalService; var query = new ApplyWithDrawQuery { MemberId = userid, ApplyType = applyType, PageSize = rows, PageNo = page }; var pageMode = capitalService.GetApplyWithDraw(query); var model = pageMode.Models.ToList().Select(e => { string applyStatus = string.Empty; if (e.ApplyStatus == Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail || e.ApplyStatus == Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm ) { applyStatus = "提现中"; } else if (e.ApplyStatus == Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { applyStatus = "提现失败"; } else if (e.ApplyStatus == Himall.Entities.ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess) { applyStatus = "提现成功"; } return(new ApplyWithDrawModel { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = applyStatus, ApplyTime = e.ApplyTime.ToString(), ApplyType = e.ApplyType }); }); var models = new DataGridModel <ApplyWithDrawModel> { rows = model, total = pageMode.Total }; return(Json(models)); }
public JsonResult ApplyWithDrawList(int page, int rows) { IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>(); ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery() { memberId = new long?(base.CurrentUser.Id), PageSize = rows, PageNo = page, Sort = "ApplyTime" }; PageModel <ApplyWithDrawInfo> applyWithDraw = memberCapitalService.GetApplyWithDraw(applyWithDrawQuery); IEnumerable <ApplyWithDrawModel> applyWithDrawModels = applyWithDraw.Models.ToList().Select <ApplyWithDrawInfo, ApplyWithDrawModel>((ApplyWithDrawInfo e) => { string empty = string.Empty; if (e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail || e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm) { empty = "提现中"; } else if (e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { empty = "提现失败"; } else if (e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess) { empty = "提现成功"; } return(new ApplyWithDrawModel() { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = empty, ApplyTime = e.ApplyTime.ToString() }); }); DataGridModel <ApplyWithDrawModel> dataGridModel = new DataGridModel <ApplyWithDrawModel>() { rows = applyWithDrawModels, total = applyWithDraw.Total }; return(Json(dataGridModel)); }
public QueryPageModel <ApplyWithdrawInfo> GetApplyWithDraw(ApplyWithDrawQuery query) { var db = WhereBuilder(query); if (string.IsNullOrWhiteSpace(query.Sort)) { db.OrderBy(e => e.ApplyStatus).OrderByDescending(e => e.ApplyTime); } else { db.OrderByDescending(e => e.ApplyTime); } var model = db.ToPagedList(query.PageNo, query.PageSize); return(new QueryPageModel <ApplyWithdrawInfo> { Models = model, Total = model.TotalRecordCount }); }
public PageModel <ApplyWithDrawInfo> GetApplyWithDraw(ApplyWithDrawQuery query) { IQueryable <ApplyWithDrawInfo> memId = context.ApplyWithDrawInfo.AsQueryable <ApplyWithDrawInfo>(); if (query.memberId.HasValue) { memId = from e in memId where e.MemId == query.memberId select e; } if (query.withDrawNo.HasValue) { memId = from e in memId where e.Id == query.withDrawNo select e; } if (query.withDrawStatus.HasValue && query.withDrawStatus.Value != 0) { memId = from e in memId where (int)e.ApplyStatus == (int)query.withDrawStatus.Value select e; } int num = 0; IQueryable <ApplyWithDrawInfo> applyWithDrawInfos = memId; applyWithDrawInfos = (!string.IsNullOrWhiteSpace(query.Sort) ? memId.GetPage(out num, query.PageNo, query.PageSize, (IQueryable <ApplyWithDrawInfo> p) => from e in p orderby e.ApplyTime descending select e) : memId.GetPage(out num, query.PageNo, query.PageSize, (IQueryable <ApplyWithDrawInfo> p) => from e in p orderby e.ApplyStatus, e.ApplyTime descending select e)); return(new PageModel <ApplyWithDrawInfo>() { Models = applyWithDrawInfos, Total = num }); }
public JsonResult ApplyWithDrawListByUser(long userid, UserWithdrawType?applyType, int page, int rows) { IMemberCapitalService service = this._iMemberCapitalService; ApplyWithDrawQuery query = new ApplyWithDrawQuery { memberId = new long?(userid), ApplyType = applyType, PageSize = rows, PageNo = page }; ObsoletePageModel <ApplyWithDrawInfo> applyWithDraw = service.GetApplyWithDraw(query); IEnumerable <ApplyWithDrawModel> enumerable = applyWithDraw.Models.ToList <ApplyWithDrawInfo>().Select <ApplyWithDrawInfo, ApplyWithDrawModel>(delegate(ApplyWithDrawInfo e) { string str = string.Empty; if ((e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail) || (e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm)) { str = "提现中"; } else if (e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { str = "提现失败"; } else if (e.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess) { str = "提现成功"; } return(new ApplyWithDrawModel { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = str, ApplyTime = e.ApplyTime.ToString(), ApplyType = e.ApplyType }); }); DataGridModel <ApplyWithDrawModel> data = new DataGridModel <ApplyWithDrawModel> { rows = enumerable, total = applyWithDraw.Total }; return(base.Json(data)); }
/// <summary> /// 取申请提现记录 /// </summary> /// <param name="MemId"></param> /// <returns></returns> public static ObsoletePageModel <ApplyWithDrawInfo> GetApplyWithDraw(ApplyWithDrawQuery query) { return(_iMemberCapitalService.GetApplyWithDraw(query)); }
public JsonResult ConfirmPay(long id, ApplyWithDrawInfo.ApplyWithDrawStatus status, string remark) { JsonResult jsonResult; IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>(); if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { memberCapitalService.RefuseApplyWithDraw(id, status, base.CurrentManager.UserName, remark); return(Json(new { success = true, msg = "审核成功!" })); } ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery() { withDrawNo = new long?(id), PageNo = 1, PageSize = 1 }; ApplyWithDrawQuery applyWithDrawQuery1 = applyWithDrawQuery; ApplyWithDrawInfo applyWithDrawInfo = memberCapitalService.GetApplyWithDraw(applyWithDrawQuery1).Models.FirstOrDefault(); Plugin <IPaymentPlugin> plugin = ( from e in PluginsManagement.GetPlugins <IPaymentPlugin>(true) where e.PluginInfo.PluginId.ToLower().Contains("weixin") select e).FirstOrDefault <Plugin <IPaymentPlugin> >(); if (plugin == null) { return(Json(new { success = false, msg = "未找到支付插件" })); } try { EnterprisePayPara enterprisePayPara = new EnterprisePayPara() { amount = applyWithDrawInfo.ApplyAmount, check_name = false, openid = applyWithDrawInfo.OpenId, out_trade_no = applyWithDrawInfo.Id.ToString(), desc = "提现" }; PaymentInfo paymentInfo = plugin.Biz.EnterprisePay(enterprisePayPara); ApplyWithDrawInfo applyWithDrawInfo1 = new ApplyWithDrawInfo() { PayNo = paymentInfo.TradNo, ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess, Remark = plugin.PluginInfo.Description, PayTime = new DateTime?((paymentInfo.TradeTime.HasValue ? paymentInfo.TradeTime.Value : DateTime.Now)), ConfirmTime = new DateTime?(DateTime.Now), OpUser = base.CurrentManager.UserName, ApplyAmount = applyWithDrawInfo.ApplyAmount, Id = applyWithDrawInfo.Id }; memberCapitalService.ConfirmApplyWithDraw(applyWithDrawInfo1); return(Json(new { success = true, msg = "付款成功" })); } catch (Exception exception) { Log.Error(string.Concat("调用企业付款接口异常:", exception.Message)); ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo() { ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail, Remark = plugin.PluginInfo.Description, ConfirmTime = new DateTime?(DateTime.Now), OpUser = base.CurrentManager.UserName, ApplyAmount = applyWithDrawInfo.ApplyAmount, Id = applyWithDrawInfo.Id }; memberCapitalService.ConfirmApplyWithDraw(applyWithDrawInfo2); jsonResult = Json(new { success = false, msg = "付款接口异常" }); } return(jsonResult); }
public static int GetApplyWithDrawCount(ApplyWithDrawQuery query) { return(Service.GetApplyWithDrawCount(query)); }
public int GetApplyWithDrawCount(ApplyWithDrawQuery query) { var db = WhereBuilder(query); return(db.Count()); }
/// <summary> /// 取申请提现记录 /// </summary> /// <param name="MemId"></param> /// <returns></returns> public static QueryPageModel <ApplyWithDrawInfo> GetApplyWithDraw(ApplyWithDrawQuery query) { return(Service.GetApplyWithDraw(query)); }
public JsonResult ApplyWithDrawList(ApplyWithDrawInfo.ApplyWithDrawStatus capitalType, UserWithdrawType?applyType, string withdrawno, string user, int page, int rows) { IMemberCapitalService memberCapitalService = this._iMemberCapitalService; IMemberService memberService = this._iMemberService; long?nullable = new long?(); if (!string.IsNullOrWhiteSpace(user)) { UserMemberInfo userMemberInfo = memberService.GetMemberByName(user); if (userMemberInfo == null) { userMemberInfo = new UserMemberInfo() { Id = 0L } } ; nullable = new long?(userMemberInfo.Id); } ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery(); applyWithDrawQuery.memberId = nullable; applyWithDrawQuery.ApplyType = applyType; applyWithDrawQuery.PageSize = rows; applyWithDrawQuery.PageNo = page; applyWithDrawQuery.withDrawStatus = new ApplyWithDrawInfo.ApplyWithDrawStatus?(capitalType); ApplyWithDrawQuery query = applyWithDrawQuery; if (!string.IsNullOrWhiteSpace(withdrawno)) { query.withDrawNo = new long?(long.Parse(withdrawno)); } ObsoletePageModel <ApplyWithDrawInfo> applyWithDraw = memberCapitalService.GetApplyWithDraw(query); IEnumerable <ApplyWithDrawModel> enumerable = Enumerable.Select <ApplyWithDrawInfo, ApplyWithDrawModel>((IEnumerable <ApplyWithDrawInfo>)Enumerable.ToList <ApplyWithDrawInfo>((IEnumerable <ApplyWithDrawInfo>)applyWithDraw.Models), (Func <ApplyWithDrawInfo, ApplyWithDrawModel>)(e => { string str = EnumHelper.ToDescription((Enum)e.ApplyStatus); UserMemberInfo member = memberService.GetMember(e.MemId); return(new ApplyWithDrawModel() { Id = e.Id, ApplyAmount = e.ApplyAmount, ApplyStatus = e.ApplyStatus, ApplyStatusDesc = str, ApplyTime = e.ApplyTime.ToString(), NickName = e.NickName, MemberName = member.UserName, ConfirmTime = e.ConfirmTime.ToString(), MemId = e.MemId, OpUser = e.OpUser, PayNo = e.PayNo, PayTime = e.PayTime.ToString(), Remark = e.Remark }); })); return(this.Json((object)new DataGridModel <ApplyWithDrawModel>() { rows = enumerable, total = applyWithDraw.Total })); }
public JsonResult ConfirmApply(long id, ApplyWithDrawInfo.ApplyWithDrawStatus comfirmStatus, string remark) { var service = _iMemberCapitalService; ApplyWithDrawQuery query = new ApplyWithDrawQuery { withDrawNo = id, PageNo = 1, PageSize = 1 }; var status = comfirmStatus; var model = service.GetApplyWithDraw(query).Models.FirstOrDefault(); if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse) { service.RefuseApplyWithDraw(id, status, CurrentManager.UserName, remark); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核拒绝,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new { success = true, msg = "审核成功!" })); } else { var plugins = PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(e => e.PluginInfo.PluginId.ToLower().Contains("weixin")).FirstOrDefault(); if (plugins != null) { try { EnterprisePayPara para = new EnterprisePayPara() { amount = model.ApplyAmount, check_name = false, openid = model.OpenId, out_trade_no = model.Id.ToString(), desc = "提现" }; PaymentInfo result = plugins.Biz.EnterprisePay(para); ApplyWithDrawInfo info = new ApplyWithDrawInfo { PayNo = result.TradNo, ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess, Remark = plugins.PluginInfo.Description, PayTime = result.TradeTime.HasValue ? result.TradeTime.Value : DateTime.Now, ConfirmTime = DateTime.Now, OpUser = CurrentManager.UserName, ApplyAmount = model.ApplyAmount, Id = model.Id }; //Log.Debug("提现:" + info.PayNo); service.ConfirmApplyWithDraw(info); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核成功,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); } catch (PluginException pex) {//插件异常,直接返回错误信息 Log.Error("调用企业付款接口异常:" + pex.Message); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new { success = false, msg = pex.Message })); } catch (Exception ex) { Log.Error("提现审核异常:" + ex.Message); ApplyWithDrawInfo info = new ApplyWithDrawInfo { ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail, Remark = plugins.PluginInfo.Description, ConfirmTime = DateTime.Now, OpUser = CurrentManager.UserName, ApplyAmount = model.ApplyAmount, Id = model.Id }; service.ConfirmApplyWithDraw(info); //操作日志 _iOperationLogService.AddPlatformOperationLog( new LogInfo { Date = DateTime.Now, Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", model.MemId, status, remark), IPAddress = Request.UserHostAddress, PageUrl = "/Admin/Capital/WithDraw", UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new { success = false, msg = "付款接口异常" })); } } else { return(Json(new { success = false, msg = "未找到支付插件" })); } } return(Json(new { success = true, msg = "付款成功" })); }