public void ProcessRequest(HttpContext context) { string cache = context.Request["cache"]; if (RedisHelper.RedisHelper.KeyExists(cache)) { ExportCache exCache = RedisHelper.RedisHelper.StringGet <ExportCache>(cache); context.Response.ContentType = "application/vnd.ms-excel"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Charset = ""; context.Response.AddHeader("Content-Disposition", "attachment;fileName=" + exCache.FileName); context.Response.BinaryWrite(exCache.Stream.GetBuffer()); context.Response.End(); } else { context.Response.Write("文件已过期"); } }
public void ProcessRequest(HttpContext context) { string cache = context.Request["cache"]; object obj = ZentCloud.Common.DataCache.GetCache(cache); if (obj != null) { ExportCache exCache = (ExportCache)obj; context.Response.ContentType = "application/vnd.ms-excel"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Charset = ""; context.Response.AddHeader("Content-Disposition", "attachment;fileName=" + exCache.FileName); context.Response.BinaryWrite(exCache.Stream.GetBuffer()); context.Response.End(); } else { context.Response.Write("文件已过期"); } }
public void ProcessRequest(HttpContext context) { string member = context.Request["member"]; int maxLevel = int.MaxValue; string max_level = context.Request["max_level"]; if (!string.IsNullOrWhiteSpace(max_level)) { maxLevel = Convert.ToInt32(max_level); } string websiteOwner = bllUser.WebsiteOwner; string userId = ""; UserInfo baseUser = new UserInfo(); if (string.IsNullOrWhiteSpace(member)) { userId = websiteOwner; baseUser = bllUser.GetSpreadUser(userId, websiteOwner); } else { baseUser = bllUser.GetSpreadUser(member, websiteOwner, 10, true); if (baseUser.UserID != websiteOwner && baseUser.MemberLevel < 10) { baseUser = null; userId = "-1"; } else { userId = baseUser.UserID; } } DataTable dt = new DataTable(); dt.Columns.Add("角色", typeof(string)); dt.Columns.Add("会员手机", typeof(string)); dt.Columns.Add("会员姓名", typeof(string)); dt.Columns.Add("会员身份证", typeof(string)); dt.Columns.Add("推荐人手机", typeof(string)); dt.Columns.Add("推荐人姓名", typeof(string)); dt.Columns.Add("会员级别", typeof(string)); dt.Columns.Add("状态", typeof(string)); dt.Columns.Add("注册时间", typeof(string)); if (baseUser != null) { List <UserLevelConfig> lvlist = bll.QueryUserLevelList(websiteOwner, "DistributionOnLine", showAll: true, colName: "AutoId,LevelNumber,LevelString"); Dictionary <int, string> dicLevel = new Dictionary <int, string>(); foreach (UserLevelConfig item in lvlist) { if (!dicLevel.ContainsKey(item.LevelNumber)) { dicLevel.Add(item.LevelNumber, item.LevelString); } } DataRow dr = dt.NewRow(); dr["角色"] = "团队管理员"; dr["会员手机"] = baseUser.Phone; dr["会员姓名"] = baseUser.TrueName; dr["会员身份证"] = baseUser.IdentityCard; if (!string.IsNullOrWhiteSpace(baseUser.DistributionOwner)) { UserInfo bpUser = bllUser.GetUserInfo(baseUser.DistributionOwner, websiteOwner); if (bpUser != null) { dr["推荐人手机"] = bpUser.Phone; dr["推荐人姓名"] = bpUser.TrueName; } } dr["会员级别"] = dicLevel.ContainsKey(baseUser.MemberLevel) ? dicLevel[baseUser.MemberLevel] : ""; dr["状态"] = (baseUser.EmptyBill == 1?"空单":"实单") + (baseUser.MemberApplyStatus == 9?"已审":"未审"); dr["注册时间"] = baseUser.Regtime.Value.ToString("yyyy-MM-dd HH:mm:ss"); dt.Rows.Add(dr); List <UserInfo> childs = bll.GetTeamList(userId, websiteOwner, true, maxLevel, "AutoID,UserID,TrueName,WXNickname,Regtime,Phone,DistributionOwner,MemberLevel,EmptyBill,MemberApplyStatus,IdentityCard"); foreach (var item in childs) { UserInfo pu = childs.FirstOrDefault(p => p.UserID == item.DistributionOwner); if (pu == null && item.DistributionOwner == baseUser.UserID) { pu = baseUser; } DataRow drn = dt.NewRow(); drn["角色"] = "下级团员"; drn["会员手机"] = item.Phone; drn["会员姓名"] = item.TrueName; drn["会员身份证"] = item.IdentityCard; drn["推荐人手机"] = pu.Phone; drn["推荐人姓名"] = pu.TrueName; drn["会员级别"] = dicLevel.ContainsKey(item.MemberLevel) ? dicLevel[item.MemberLevel] : ""; drn["状态"] = (item.EmptyBill == 1 ? "空单" : "实单") + (item.MemberApplyStatus == 9 ? "已审" : "未审"); drn["注册时间"] = item.Regtime.Value.ToString("yyyy-MM-dd HH:mm:ss"); dt.Rows.Add(drn); } dt.AcceptChanges(); } MemoryStream ms = Web.DataLoadTool.NPOIHelper.Export(dt, "团队信息"); ExportCache exCache = new ExportCache() { FileName = string.Format("团队信息{0}.xls", DateTime.Now.ToString("yyyyMMddHHmm")), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); ZentCloud.Common.DataCache.SetCache(cache, exCache, slidingExpiration: TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { int rows = int.MaxValue; int page = 1; string score_type = context.Request["score_type"]; string score_events = context.Request["score_events"]; string member = context.Request["member"]; string start = context.Request["start"]; string end = context.Request["end"]; string is_print = context.Request["is_print"]; if (!string.IsNullOrWhiteSpace(end)) { end = Convert.ToDateTime(end).ToString("yyyy-MM-dd 23:59:59.999"); } string websiteOwner = bll.WebsiteOwner; string memberUserIds = ""; if (!string.IsNullOrWhiteSpace(member)) { memberUserIds = bllUser.GetSpreadUserIds(member, websiteOwner); } List <UserScoreDetailsInfo> list = bll.GetScoreList(rows, page, bll.WebsiteOwner, score_type, userIDs: memberUserIds, colName: "AutoID,UserID,Score,AddNote,AddTime,ScoreEvent,EventScore,DeductScore,Ex1,Ex2,Ex3,Ex4,Ex5,RelationID,SerialNumber", scoreEvents: score_events, startTime: start, endTime: end, isPrint: is_print); List <UserInfo> users = new List <UserInfo>(); DataTable dt = new DataTable(); dt.Columns.Add("记录编号", typeof(int)); dt.Columns.Add("会员编号", typeof(int)); dt.Columns.Add("会员姓名", typeof(string)); dt.Columns.Add("会员手机", typeof(string)); dt.Columns.Add("时间", typeof(string)); dt.Columns.Add("余额变动", typeof(double)); dt.Columns.Add("事件", typeof(string)); if (is_print == "1") { dt.Columns.Add("充值渠道", typeof(string)); dt.Columns.Add("商户单号", typeof(string)); dt.Columns.Add("支付单号", typeof(string)); dt.Columns.Add("开户银行", typeof(string)); dt.Columns.Add("开户名", typeof(string)); dt.Columns.Add("银行卡号", typeof(string)); dt.Columns.Add("税费", typeof(double)); } else { dt.Columns.Add("说明", typeof(string)); dt.Columns.Add("公积金/扣税", typeof(double)); } if (list.Count > 0) { list.Select(p => p.UserID).ToList(); string userIds = ZentCloud.Common.MyStringHelper.ListToStr(list.Select(p => p.UserID).ToList(), "'", ","); users = bll.GetColMultListByKey <UserInfo>(rows, 1, "UserID", userIds, "AutoID,UserID,TrueName,WXNickname,Phone", websiteOwner: websiteOwner); foreach (UserScoreDetailsInfo item in list) { DataRow dr = dt.NewRow(); UserInfo nu = users.FirstOrDefault(p => p.UserID == item.UserID); string id = nu == null ? " " : nu.AutoID.ToString(); string name = bllUser.GetUserDispalyName(nu); string phone = nu == null || string.IsNullOrWhiteSpace(nu.Phone) ? " " : nu.Phone; dr["记录编号"] = item.AutoID.Value; dr["会员编号"] = id; dr["会员姓名"] = name; dr["会员手机"] = phone; dr["时间"] = item.AddTime.ToString("yyyy/MM/dd HH:mm:ss"); dr["余额变动"] = Math.Round(item.Score, 2); dr["事件"] = item.ScoreEvent; if (is_print == "1") { if (item.ScoreEvent.Contains("提现")) { dr["开户银行"] = item.Ex1; dr["开户名"] = item.Ex2; dr["银行卡号"] = item.Ex3; dr["税费"] = Math.Round(item.DeductScore, 2); } else { string ex1 = ""; if (item.Ex5 == "alipay") { ex1 = "支付宝"; } else if (item.Ex5 == "weixin") { ex1 = "微信"; } else { ex1 = item.Ex1; } dr["充值渠道"] = ex1; if (!item.ScoreEvent.Contains("线下")) { dr["商户单号"] = item.RelationID; } dr["支付单号"] = item.SerialNumber; } } else { if (nu != null) { dr["说明"] = item.AddNote.Replace("转账给您", string.Format("转账给{0}({1})", name, id, phone)); } else { dr["说明"] = item.AddNote.Replace("转账给您", string.Format("转账给[{0}]", item.UserID)); } dr["公积金/扣税"] = Math.Round(item.DeductScore, 2); } dt.Rows.Add(dr); } dt.AcceptChanges(); } string fname = is_print == "1" ? "充值提现记录" : "财务明细"; MemoryStream ms = Web.DataLoadTool.NPOIHelper.Export(dt, fname); ExportCache exCache = new ExportCache() { FileName = string.Format("{1}{0}.xls", DateTime.Now.ToString("yyyyMMddHHmm"), fname), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); ZentCloud.Common.DataCache.SetCache(cache, exCache, slidingExpiration: TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { int rows = int.MaxValue; int page = 1; int yearMonth = Convert.ToInt32(context.Request["yearmonth"]); string up_member = context.Request["up_member"]; string member = context.Request["member"]; string websiteOwner = bll.WebsiteOwner; string userIds = ""; #region 查出userIds if (!string.IsNullOrWhiteSpace(member)) { userIds = bllUser.GetSpreadUserIds(member, websiteOwner); } string parentIds = ""; if (!string.IsNullOrWhiteSpace(up_member)) { parentIds = bllUser.GetSpreadUserIds(up_member, websiteOwner); } #endregion int total = bll.GetChildPerformanceCount(parentIds, websiteOwner, yearMonth, userIds); List <TeamPerformance> performanceList = new List <TeamPerformance>(); if (total > 0) { performanceList = bll.GetChildPerformanceList(rows, page, parentIds, websiteOwner, yearMonth, userIds, "AutoID,UserName,UserPhone,DistributionOwner,YearMonth,Performance,Reward,Status"); } DataTable dt = new DataTable(); dt.Columns.Add("会员手机", typeof(string)); dt.Columns.Add("会员姓名", typeof(string)); dt.Columns.Add("推荐人手机", typeof(string)); dt.Columns.Add("推荐人姓名", typeof(string)); dt.Columns.Add("月份", typeof(int)); dt.Columns.Add("公司", typeof(string)); dt.Columns.Add("业绩", typeof(decimal)); dt.Columns.Add("管理奖", typeof(decimal)); if (performanceList.Count > 0) { List <string> uIdList = performanceList.Select(p => p.UserId).Distinct().ToList(); uIdList.AddRange(performanceList.Select(p => p.DistributionOwner).Distinct().ToList()); string uIds = ZentCloud.Common.MyStringHelper.ListToStr(uIdList, "'", ","); List <UserInfo> uList = bllUser.GetColMultListByKey <UserInfo>(int.MaxValue, 1, "UserID", uIds, "AutoID,WXNickname,TrueName,Phone,UserID,IntelligenceCertificateBusiness", websiteOwner: websiteOwner); foreach (TeamPerformance item in performanceList) { UserInfo u = uList.FirstOrDefault(p => p.UserID == item.UserId); UserInfo upUser = uList.FirstOrDefault(p => p.UserID == item.DistributionOwner); DataRow dr = dt.NewRow(); dr["会员手机"] = u == null ? item.UserPhone : u.Phone; dr["会员姓名"] = u == null? item.UserName: bllUser.GetUserDispalyName(u); dr["推荐人手机"] = upUser == null ? "" : upUser.Phone; dr["推荐人姓名"] = upUser == null ? "" : upUser.TrueName; dr["月份"] = item.YearMonth; dr["公司"] = u == null ? "" : u.IntelligenceCertificateBusiness; dr["业绩"] = item.Performance; dr["管理奖"] = item.Reward; dt.Rows.Add(dr); } dt.AcceptChanges(); } MemoryStream ms = Web.DataLoadTool.NPOIHelper.Export(dt, "会员业绩"); ExportCache exCache = new ExportCache() { FileName = string.Format("会员业绩{0}.xls", DateTime.Now.ToString("yyyyMMddHHmm")), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); ZentCloud.Common.DataCache.SetCache(cache, exCache, slidingExpiration: TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string id = context.Request["id"]; string websiteOwner = bll.WebsiteOwner; TeamPerformance myPerformance = bll.GetByKey <TeamPerformance>("AutoID", id, websiteOwner: websiteOwner); UserInfo user = bllUser.GetUserInfo(myPerformance.UserId, websiteOwner); List <UserLevelConfig> userLvlist = bll.QueryUserLevelList(websiteOwner, "DistributionOnLine", levelNumber: user.MemberLevel.ToString(), colName: "AutoId,LevelNumber,LevelString", showAll: true); string templatePath = context.Server.MapPath("/JsonConfig/ExcelTemplate/业绩确认表模板.xlsx"); Dictionary <String, Object> dictSource = new Dictionary <string, object>(); if (userLvlist.Count > 0) { dictSource.Add("lvname", userLvlist[0].LevelString); } dictSource.Add("name", user.TrueName); dictSource.Add("performance", Convert.ToDouble(myPerformance.Performance).ToString()); dictSource.Add("rate", Convert.ToDouble(myPerformance.Rate) + "%"); dictSource.Add("totalreward", Convert.ToDouble(myPerformance.TotalReward).ToString()); dictSource.Add("childreward", Convert.ToDouble(myPerformance.ChildReward).ToString()); dictSource.Add("fund", Convert.ToDouble((myPerformance.Reward * 20 / 100)).ToString()); decimal trueamount = (myPerformance.Reward * 80 / 100); dictSource.Add("amount", Convert.ToDouble(trueamount).ToString()); string ym = myPerformance.YearMonth.ToString(); string dicYearmonth = ym.Substring(0, 4) + "年" + ym.Substring(4) + "月"; string dicMinAmount = trueamount.ToString("N"); dictSource.Add("lower", string.Format("{0}应结算总金额 人民币小写:{1}", dicYearmonth, dicMinAmount)); string cnAmount = CommonPlatform.Helper.MoneyHelper.GetCnString(trueamount.ToString()); dictSource.Add("upper", string.Format(" 人民币大写:{0}", cnAmount)); List <TeamPerformanceDetails> performanceList = bll.GetPerformanceDetailList(int.MaxValue, 1, "", "", websiteOwner, myPerformance.YearMonth, "", myPerformance.DetailIds); DataTable dt = null; if (performanceList.Count > 0) { List <lvGroup> lvList = performanceList.Where(p => p.AddType == "注册").GroupBy(g => new{ up = g.Performance, cate = g.AddNote.Replace("注册", "").Replace("实单审核", "") }).Select(l => new lvGroup { cate = l.Key.cate, count = l.Count(), up = l.Key.up, amount = l.Sum(li => li.Performance) }).OrderBy(a => a.amount).ToList(); List <lvGroup> upList = performanceList.Where(p => p.AddType == "升级").GroupBy(g => new{ cate = "升级金额" }).Select(l => new lvGroup { cate = l.Key.cate, count = l.Count(), amount = l.Sum(li => li.Performance) }).OrderBy(a => a.amount).ToList(); List <lvGroup> ceList = performanceList.Where(p => p.AddType == "撤单").GroupBy(g => new { cate = "撤单扣除" }).Select(l => new lvGroup { cate = l.Key.cate, count = l.Count(), amount = l.Sum(li => li.Performance) }).OrderBy(a => a.amount).ToList(); List <lvGroup> upuList = performanceList.Where(p => p.AddType == "变更").GroupBy(g => new { cate = "变更上级" }).Select(l => new lvGroup { cate = l.Key.cate, count = l.Count(), amount = l.Sum(li => li.Performance) }).OrderBy(a => a.amount).ToList(); lvList.AddRange(upList); lvList.AddRange(ceList); lvList.AddRange(upuList); if (lvList.Count > 0) { dt = new DataTable(); dt.Columns.Add("num", typeof(string)); dt.Columns.Add("cate", typeof(string)); dt.Columns.Add("count", typeof(int)); dt.Columns.Add("up", typeof(string)); dt.Columns.Add("amount", typeof(string)); int num = 0; foreach (var item in lvList) { num++; DataRow dr = dt.NewRow(); dr["num"] = num.ToString().PadLeft(3, '0'); dr["cate"] = item.cate; dr["count"] = item.count; dr["up"] = item.up == 0 ? "" : Convert.ToDouble(item.up).ToString(); dr["amount"] = Convert.ToDouble(item.amount).ToString(); dt.Rows.Add(dr); } dictSource.Add("sumcount", lvList.Sum(p => p.count)); decimal sumamount = lvList.Sum(p => p.amount); dictSource.Add("sumamount", Convert.ToDouble(sumamount).ToString()); } } if (dt != null) { dt.TableName = "detail"; dt.AcceptChanges(); } MemoryStream ms = CommonPlatform.Helper.Aspose.ExcelHelper.OutModelFileToStream(templatePath, dictSource, dt); ExportCache exCache = new ExportCache() { FileName = string.Format("{1}业绩确认表_{0}.xls", user.TrueName, dicYearmonth), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); ZentCloud.Common.DataCache.SetCache(cache, exCache, slidingExpiration: TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string type = context.Request["type"]; string member = context.Request["member"]; string websiteOwner = bllUser.WebsiteOwner; string userIds = ""; UserExpandType nType = new UserExpandType(); if (!Enum.TryParse(type, out nType)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "类型格式不能识别"; bllUserEx.ContextResponse(context, apiResp); return; } string tname = BLLUserExpand.dicTypes[type]; if (!string.IsNullOrWhiteSpace(member)) { userIds = bllUser.GetSpreadUserIds(member, websiteOwner); } List <UserExpand> list = bllUserEx.GetExpandList(int.MaxValue, 1, nType, userIds); DataTable dt = new DataTable(); dt.Columns.Add("会员编号", typeof(int)); dt.Columns.Add("会员手机", typeof(string)); dt.Columns.Add("会员姓名", typeof(string)); if (BLLUserExpand.dicColumns.ContainsKey(type)) { foreach (var item in BLLUserExpand.dicColumns[type]) { dt.Columns.Add(item.name, typeof(string)); } } if (list.Count > 0) { string uIds = ZentCloud.Common.MyStringHelper.ListToStr(list.Select(p => p.UserId).ToList(), "'", ","); List <UserInfo> uList = bllUser.GetColMultListByKey <UserInfo>(int.MaxValue, 1, "UserID", uIds, "AutoID,WXNickname,TrueName,Phone,UserID", websiteOwner: websiteOwner); foreach (var item in list) { UserInfo u = uList.FirstOrDefault(p => p.UserID == item.UserId); DataRow dr = dt.NewRow(); dr["会员编号"] = u == null ? 0 : u.AutoID; dr["会员手机"] = u == null ? "" : u.Phone; dr["会员姓名"] = u == null ? "" : bllUser.GetUserDispalyName(u); if (BLLUserExpand.dicColumns.ContainsKey(type)) { JObject jOb = JObject.FromObject(item); foreach (var col in BLLUserExpand.dicColumns[type]) { if (!string.IsNullOrWhiteSpace(col.mfield)) { dr[col.name] = jOb[col.mfield]; } } } dt.Rows.Add(dr); } dt.TableName = tname; dt.AcceptChanges(); } MemoryStream ms = Web.DataLoadTool.NPOIHelper.Export(dt, tname); ExportCache exCache = new ExportCache() { FileName = string.Format("{0}.xls", tname), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); RedisHelper.RedisHelper.StringSetSerialize(cache, exCache, TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { int rows = int.MaxValue; int page = 1; string id = context.Request["id"]; string websiteOwner = bll.WebsiteOwner; TeamPerformance performance = bll.GetColByKey <TeamPerformance>("AutoId", id, "AutoId,YearMonth,DetailIds"); string ids = string.IsNullOrWhiteSpace(performance.DetailIds) ? "-1" : performance.DetailIds; int yearMonth = performance.YearMonth; int total = bll.GetPerformanceDetailCount("", "", websiteOwner, yearMonth, "", ids); List <TeamPerformanceDetails> performanceList = new List <TeamPerformanceDetails>(); if (total > 0) { performanceList = bll.GetPerformanceDetailList(rows, page, "", "", websiteOwner, yearMonth, "", ids); } DataTable dt = new DataTable(); dt.Columns.Add("会员手机", typeof(string)); dt.Columns.Add("会员姓名", typeof(string)); dt.Columns.Add("推荐人手机", typeof(string)); dt.Columns.Add("推荐人姓名", typeof(string)); dt.Columns.Add("月份", typeof(int)); dt.Columns.Add("事件", typeof(string)); dt.Columns.Add("金额", typeof(decimal)); dt.Columns.Add("时间", typeof(string)); dt.Columns.Add("说明", typeof(string)); if (performanceList.Count > 0) { string parentIds = ZentCloud.Common.MyStringHelper.ListToStr(performanceList.Select(p => p.DistributionOwner).ToList(), "'", ","); List <UserInfo> uuList = bll.GetColMultListByKey <UserInfo>(int.MaxValue, 1, "UserID", parentIds, "AutoID,UserID,TrueName,Phone", websiteOwner: websiteOwner); foreach (TeamPerformanceDetails item in performanceList) { UserInfo pu = uuList.FirstOrDefault(p => p.UserID == item.DistributionOwner); DataRow dr = dt.NewRow(); dr["会员手机"] = item.UserPhone; dr["会员姓名"] = item.UserName; dr["推荐人手机"] = pu == null ? "" : pu.Phone; dr["推荐人姓名"] = pu == null ? "" : pu.TrueName; dr["月份"] = item.YearMonth; dr["事件"] = item.AddType; dr["金额"] = item.Performance; dr["时间"] = item.AddTime.ToString("yyyy-MM-dd HH:mm:ss"); dr["说明"] = item.AddNote; dt.Rows.Add(dr); } dt.AcceptChanges(); } MemoryStream ms = Web.DataLoadTool.NPOIHelper.Export(dt, "会员业绩明细"); ExportCache exCache = new ExportCache() { FileName = string.Format("会员业绩明细{0}.xls", DateTime.Now.ToString("yyyyMMddHHmm")), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); ZentCloud.Common.DataCache.SetCache(cache, exCache, slidingExpiration: TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { int rows = int.MaxValue; int page = 1; string member = context.Request["member"]; string up_member = context.Request["up_member"]; string reg_member = context.Request["reg_member"]; string empty_bill = context.Request["empty_bill"]; string true_bill = context.Request["true_bill"]; string apply_pass = context.Request["apply_pass"]; string apply_other = context.Request["apply_other"]; string has_img = context.Request["has_img"]; string no_img = context.Request["no_img"]; string apply_cancel = context.Request["apply_cancel"]; string is_cancel = context.Request["is_cancel"]; string start = context.Request["start"]; string end = context.Request["end"]; string min_level = context.Request["min_level"]; string level_num = context.Request["level_num"]; string websiteOwner = bll.WebsiteOwner; string distributionOwners = ""; if (!string.IsNullOrWhiteSpace(up_member)) { distributionOwners = bllUser.GetSpreadUserIds(up_member, websiteOwner); } string regUserIds = ""; if (!string.IsNullOrWhiteSpace(reg_member)) { regUserIds = bllUser.GetSpreadUserIds(reg_member, websiteOwner); } string bill = ""; if (empty_bill == "1" && true_bill != "1") { bill = "1"; } else if (empty_bill != "1" && true_bill == "1") { bill = "0"; } string apply = ""; if (apply_pass == "1" && apply_other != "1") { apply = "1"; } else if (apply_pass != "1" && apply_other == "1") { apply = "0"; } string hasImg = ""; if (has_img == "1" && no_img != "1") { hasImg = "1"; } else if (has_img != "1" && no_img == "1") { hasImg = "0"; } if (!string.IsNullOrWhiteSpace(end)) { end = Convert.ToDateTime(end).AddDays(1).ToString("yyyy-MM-dd"); } List <UserInfo> list = bll.GetShMemberList(rows, page, websiteOwner, min_level, member, distributionOwners, regUserIds, bill, apply, hasImg, start, end, level_num, colName: "AutoID,UserID,Phone,TrueName,Regtime,DistributionOwner,RegUserID,RegisterWay,Stock,EmptyBill" + ",MemberApplyStatus,MemberApplyTime,MemberLevel,Ex1,WebsiteOwner,IsDisable,TotalAmount,AccountAmountEstimate,AccumulationFund" + ",Province,City,District,Town,Address,IsLock", apply_cancel: apply_cancel, is_cancel: is_cancel); List <UserInfo> otherList = new List <UserInfo>(); DataTable dt = new DataTable(); dt.Columns.Add("会员编号", typeof(int)); dt.Columns.Add("会员手机", typeof(string)); dt.Columns.Add("会员姓名", typeof(string)); dt.Columns.Add("推荐人编号", typeof(string)); dt.Columns.Add("推荐人手机", typeof(string)); dt.Columns.Add("推荐人姓名", typeof(string)); dt.Columns.Add("报单人编号", typeof(string)); dt.Columns.Add("报单人手机", typeof(string)); dt.Columns.Add("报单人姓名", typeof(string)); dt.Columns.Add("注册时间", typeof(string)); dt.Columns.Add("当前级别", typeof(string)); dt.Columns.Add("状态", typeof(string)); dt.Columns.Add("报单方式", typeof(string)); dt.Columns.Add("账面余额", typeof(decimal)); dt.Columns.Add("可用余额", typeof(decimal)); dt.Columns.Add("账面公积金", typeof(decimal)); dt.Columns.Add("所在地", typeof(string)); dt.Columns.Add("地址", typeof(string)); dt.Columns.Add("是否锁定", typeof(string)); if (list.Count > 0) { List <UserLevelConfig> lvlist = bllDis.QueryUserLevelList(websiteOwner, "DistributionOnLine", colName: "AutoId,LevelNumber,LevelString", showAll: true); Dictionary <int, string> dicLevel = new Dictionary <int, string>(); foreach (UserLevelConfig item in lvlist) { if (!dicLevel.ContainsKey(item.LevelNumber)) { dicLevel.Add(item.LevelNumber, item.LevelString); } } foreach (var item in list) { UserInfo upUser = null; if (!string.IsNullOrWhiteSpace(item.DistributionOwner)) { upUser = list.FirstOrDefault(p => p.UserID == item.DistributionOwner); if (upUser == null) { otherList.FirstOrDefault(p => p.UserID == item.DistributionOwner); } if (upUser == null) { upUser = bll.GetColByKey <UserInfo>("UserID", item.DistributionOwner, "AutoID,UserID,Phone,TrueName,Regtime,DistributionOwner,RegUserID,RegisterWay,Stock,EmptyBill" + ",MemberApplyStatus,MemberLevel,Ex1,WebsiteOwner,IsDisable,TotalAmount,AccountAmountEstimate,AccumulationFund" + ",Province,City,District,Town,Address", websiteOwner: websiteOwner); if (upUser != null) { otherList.Add(upUser); } } } UserInfo regUser = null; if (!string.IsNullOrWhiteSpace(item.RegUserID)) { regUser = list.FirstOrDefault(p => p.UserID == item.RegUserID); if (regUser == null) { otherList.FirstOrDefault(p => p.UserID == item.RegUserID); } if (regUser == null) { regUser = bll.GetColByKey <UserInfo>("UserID", item.RegUserID, "AutoID,UserID,Phone,TrueName,Regtime,DistributionOwner,RegUserID,RegisterWay,Stock,EmptyBill" + ",MemberApplyStatus,MemberLevel,Ex1,WebsiteOwner,IsDisable,TotalAmount,AccountAmountEstimate,AccumulationFund" + ",Province,City,District,Town,Address", websiteOwner: websiteOwner); if (regUser != null) { otherList.Add(regUser); } } } string lvString = dicLevel.ContainsKey(item.MemberLevel) ? dicLevel[item.MemberLevel] : ""; string memberStatus = item.EmptyBill == 1 ? "空单" : "实单"; memberStatus += (item.MemberApplyStatus == 9 ? "已审" : "未审"); if (item.IsDisable == 1 && item.MemberLevel == 0) { memberStatus = "已撤单"; } else if (item.IsDisable == 1 && item.MemberLevel > 0) { memberStatus = "申请撤单"; } DataRow dr = dt.NewRow(); dr["会员编号"] = item.AutoID; dr["会员手机"] = item.Phone; dr["会员姓名"] = item.TrueName; dr["推荐人编号"] = upUser == null ? "" : upUser.AutoID.ToString(); dr["推荐人手机"] = upUser == null ? "" : upUser.Phone; dr["推荐人姓名"] = upUser == null ? "" : upUser.TrueName; dr["报单人编号"] = regUser == null ? "" : regUser.AutoID.ToString(); dr["报单人手机"] = regUser == null ? "" : regUser.Phone; dr["报单人姓名"] = regUser == null ? "" : regUser.TrueName; dr["注册时间"] = item.MemberApplyTime.ToString("yyyy/MM/dd HH:mm:ss"); dr["当前级别"] = dicLevel.ContainsKey(item.MemberLevel) ? dicLevel[item.MemberLevel] : ""; dr["状态"] = memberStatus; dr["报单方式"] = item.RegisterWay; dr["账面余额"] = item.TotalAmount; dr["可用余额"] = item.AccountAmountEstimate; dr["账面公积金"] = item.AccumulationFund; List <string> pcdt = new List <string>(); if (!string.IsNullOrWhiteSpace(item.Province)) { pcdt.Add(item.Province); } if (!string.IsNullOrWhiteSpace(item.City)) { pcdt.Add(item.City); } if (!string.IsNullOrWhiteSpace(item.District)) { pcdt.Add(item.District); } if (!string.IsNullOrWhiteSpace(item.Town)) { pcdt.Add(item.Town); } if (pcdt.Count > 0) { dr["所在地"] = ZentCloud.Common.MyStringHelper.ListToStr(pcdt, "", " "); } dr["地址"] = item.Address; dr["是否锁定"] = item.IsLock == 1 ? "锁定" : ""; dt.Rows.Add(dr); } dt.AcceptChanges(); } MemoryStream ms = Web.DataLoadTool.NPOIHelper.Export(dt, "会员信息"); ExportCache exCache = new ExportCache() { FileName = string.Format("会员信息{0}.xls", DateTime.Now.ToString("yyyyMMddHHmm")), Stream = ms }; string cache = Guid.NewGuid().ToString("N").ToUpper(); ZentCloud.Common.DataCache.SetCache(cache, exCache, slidingExpiration: TimeSpan.FromMinutes(5)); apiResp.status = true; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; apiResp.msg = "生成完成"; apiResp.result = new { cache = cache }; bllUser.ContextResponse(context, apiResp); }