public ActionResult Edit(OrderHouse OrderHouse) { if (OrderHouse.Id != 0) { OrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.Id == OrderHouse.Id); } if (OrderHouse == null) { ViewBag.ErrorMsg = "数据不存在"; return(View("Error")); } ViewBag.OrderHouse = OrderHouse; Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == OrderHouse.OId); if (Orders.PayState != 1) { ViewBag.ErrorMsg = "当前状态,不能付款!"; return(View("Error")); } if (Orders.TState != 2) { ViewBag.ErrorMsg = "交易不成功,不能付款!"; return(View("Error")); } ViewBag.Orders = Orders; ViewBag.Users = Entity.Users.FirstOrNew(n => n.Id == Orders.UId); ViewBag.SysAgent = Entity.SysAgent.FirstOrNew(n => n.Id == Orders.Agent); ViewBag.SysAdmin = Entity.SysAdmin.FirstOrNew(n => n.Id == Orders.AId); ViewBag.FinAdmin = Entity.SysAdmin.FirstOrNew(n => n.Id == Orders.FId); if (Request.UrlReferrer != null) { Session["Url"] = Request.UrlReferrer.ToString(); } return(View()); }
public void Save(OrderHouse OrderHouse) { OrderHouse baseOrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.Id == OrderHouse.Id); Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == baseOrderHouse.OId); if (BasicSet.CashPayWay == 1)//开启自动结算时执行 { //自动出款 baseOrderHouse.PayCash(Orders, Entity);//去付款 } else { if (baseOrderHouse.OrderState == 2 && baseOrderHouse.PayState == 1 && baseOrderHouse.FState == 0) { baseOrderHouse.PayState = 2; baseOrderHouse.FState = 1; baseOrderHouse.FTime = DateTime.Now; Orders.PayState = 2; Entity.SaveChanges(); //======分润====== baseOrderHouse = baseOrderHouse.PayAgent(Entity, 1); Orders.AgentPayGet = (decimal)baseOrderHouse.AgentPayGet; Entity.SaveChanges(); } } Orders.SendMsg(Entity);//发送消息类 BaseRedirect(); }
public void Save(OrderHouse OrderHouse) { OrderHouse baseOrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.Id == OrderHouse.Id); if (baseOrderHouse.OrderState == 2 && baseOrderHouse.PayState == 3) { baseOrderHouse.PayState = 4; Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == baseOrderHouse.OId); Orders.PayState = 4; //退款到余额 Users baseUsers = Entity.Users.FirstOrDefault(n => n.Id == baseOrderHouse.UId); //计算退款金额 //手续费=总房租*付房租系统费率 decimal Poundage = baseOrderHouse.PayMoney * (decimal)baseOrderHouse.UserRate; //退款金额=交易总金额-支付手续费 decimal Amoney = baseOrderHouse.Amoney - Poundage; //帐户变动记录 int USERSID = baseUsers.Id; string TNUM = Orders.TNum; string SP_Ret = Entity.SP_UsersMoney(USERSID, TNUM, Amoney, 6, ""); if (SP_Ret != "3") { Utils.WriteLog(string.Format("U{0},O{1},T{2}:{3}【{4}】", USERSID, TNUM, 6, Amoney, SP_Ret), "SP_UsersMoney"); } baseOrderHouse = baseOrderHouse.PayAgent(Entity, 2); Orders.AgentPayGet = (decimal)baseOrderHouse.AgentPayGet; Entity.SaveChanges(); //======分润====== Orders.SendMsg(Entity);//发送消息类 //T0时增加配额 if (baseOrderHouse.TrunType == 0) { decimal Money = baseOrderHouse.PayMoney; DateTime Today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); TaskTimeSet TaskTimeSet = Entity.TaskTimeSet.FirstOrDefault(n => n.ODate == Today); if (TaskTimeSet != null) { if (TaskTimeSet.UsedMoney >= Money) { TaskTimeSet.UsedMoney -= Money; } else { TaskTimeSet.UsedMoney = 0; } Entity.SaveChanges(); } } } BaseRedirect(); }
public void CancelSave(OrderHouse OrderHouse) { OrderHouse baseOrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.Id == OrderHouse.Id); if (baseOrderHouse.OrderState == 2 && ((baseOrderHouse.PayState == 1 && baseOrderHouse.FState == 0) || (baseOrderHouse.PayState == 2 && baseOrderHouse.FState == 1))) { baseOrderHouse.PayState = 3; baseOrderHouse.Remark = OrderHouse.Remark; Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == baseOrderHouse.OId); Orders.PayState = 3; Orders.Remark = OrderHouse.Remark; Entity.SaveChanges(); Orders.SendMsg(Entity);//发送消息类 } BaseRedirect(); }
public void ChangeStatus(OrderHouse OrderHouse, string InfoList, string Clomn, string Value) { //Clomn FState //InfoList //206,205,192,191,190,189,188,187,186,47,39 //value 1 if (Clomn == "FState" && Value == "1") { string[] Arr = InfoList.Split(','); if (Arr.Length > 0) { List <int> ArrInt = new List <int>(); foreach (string p in Arr) { ArrInt.Add(Int32.Parse(p)); } IList <OrderHouse> List = Entity.OrderHouse.Where(n => ArrInt.Contains(n.Id)).ToList(); foreach (var p in List) { Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == p.OId); if (BasicSet.CashPayWay == 1)//开启自动结算时执行 { //自动出款 p.PayCash(Orders, Entity);//去付款 Thread.Sleep(1200); } else { p.PayState = 2; p.FState = 1; p.FTime = DateTime.Now; //======分润====== OrderHouse OH = p.PayAgent(Entity, 1); Orders.AgentPayGet = (decimal)OH.AgentPayGet; Entity.SaveChanges(); Orders.PayState = 2; } Orders.SendMsg(Entity);//发送消息类 } Entity.SaveChanges(); Response.Write(List.Count); } } }
public void SaveEdit(OrderHouse OrderHouse) { OrderHouse baseOrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.Id == OrderHouse.Id); Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == baseOrderHouse.OId); if (baseOrderHouse.OrderState == 2 && baseOrderHouse.PayState == 3) { baseOrderHouse.PayState = 2; baseOrderHouse.FState = 1; baseOrderHouse.FTime = DateTime.Now; Orders.PayState = 2; Entity.SaveChanges(); //======分润====== baseOrderHouse = baseOrderHouse.PayAgent(Entity, 1); Orders.AgentPayGet = (decimal)baseOrderHouse.AgentPayGet; Entity.SaveChanges(); Orders.SendMsg(Entity);//发送消息类 } BaseRedirect(); }
public ActionResult Cancel(OrderHouse OrderHouse) { ViewBag.BasicDescList = GetBasicDescList(BasicCodeEnum.Fztk); if (OrderHouse.Id != 0) { OrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.Id == OrderHouse.Id); } if (OrderHouse == null) { ViewBag.ErrorMsg = "数据不存在"; return(View("Error")); } ViewBag.OrderHouse = OrderHouse; Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == OrderHouse.OId); if (Orders.PayState != 1 && Orders.PayState != 2) { ViewBag.ErrorMsg = "当前状态不能申请退款!"; return(View("Error")); } if (Orders.TState != 2) { ViewBag.ErrorMsg = "交易不成功,不能退款!"; return(View("Error")); } ViewBag.Orders = Orders; ViewBag.Users = Entity.Users.FirstOrNew(n => n.Id == Orders.UId); ViewBag.SysAgent = Entity.SysAgent.FirstOrNew(n => n.Id == Orders.Agent); ViewBag.SysAdmin = Entity.SysAdmin.FirstOrNew(n => n.Id == Orders.AId); ViewBag.FinAdmin = Entity.SysAdmin.FirstOrNew(n => n.Id == Orders.FId); if (Request.UrlReferrer != null) { Session["Url"] = Request.UrlReferrer.ToString(); } return(View()); }
public void Execute(IJobExecutionContext context) { string JobName = "OrderProfit"; string CanRun = ConfigurationManager.AppSettings["Run" + JobName].ToString(); if (CanRun == "true") { if (!IsRun) { LokFuEntity Entity = new LokFuEntity(); IsRun = true; try { Log.Write(JobName + "任务开始执行!"); //------------------------------------------------------- #region 任务主体 IList <Orders> List = Entity.Orders.Where(n => n.RunSplit == 1).Take(50).ToList(); foreach (var p in List) { p.RunSplit = 2; } Entity.SaveChanges(); foreach (var O in List) { if (O.TType == 1)//银联卡支付 { OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrDefault(n => n.OId == O.TNum); if (OrderRecharge != null) { OrderRecharge = OrderRecharge.PayAgent(Entity, 1, O.FrozenState); O.AgentPayGet = (decimal)OrderRecharge.AgentPayGet; O.AgentState = 1; } } if (O.TType == 2)//提现 { OrderCash OrderCash = Entity.OrderCash.FirstOrDefault(n => n.OId == O.TNum); if (OrderCash != null) { OrderCash = OrderCash.PayAgent(Entity, 1); O.AgentPayGet = (decimal)OrderCash.AgentCashGet; } } if (O.TType == 3)//转帐 { OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrDefault(n => n.OId == O.TNum); if (OrderTransfer != null) { OrderTransfer = OrderTransfer.PayAgent(Entity, 1); O.AgentPayGet = (decimal)OrderTransfer.AgentPayGet; } } if (O.TType == 5)//房租 { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.OId == O.TNum); if (OrderHouse != null) { OrderHouse = OrderHouse.PayAgent(Entity, 1); O.AgentPayGet = (decimal)OrderHouse.AgentPayGet; } } if (O.TType == 6)//升级 { VIPOrder VIPOrder = Entity.VIPOrder.FirstOrDefault(n => n.TNum == O.TNum); if (VIPOrder != null) { VIPOrder = VIPOrder.PayAgent(Entity, 1); O.AgentPayGet = (decimal)VIPOrder.SplitMoney; O.AgentState = 1; } } if (O.TType == 7 || O.TType == 8 || O.TType == 9)//扫码 NFC { OrderF2F OrderF2F = Entity.OrderF2F.FirstOrDefault(n => n.OId == O.TNum); if (OrderF2F != null) { OrderF2F = OrderF2F.PayAgent(Entity, 1, O.FrozenState); O.AgentPayGet = (decimal)OrderF2F.AgentPayGet; } } if (O.TType == 10)//代理自助开通 { DaiLiOrder DaiLiOrder = Entity.DaiLiOrder.FirstOrDefault(n => n.OId == O.TNum); if (DaiLiOrder != null) { DaiLiOrder = DaiLiOrder.PayAgent(Entity, 1); O.AgentPayGet = (decimal)DaiLiOrder.AgentGet; O.AgentState = 1; } } O.RunSplit = 3; Entity.SaveChanges(); } #endregion //------------------------------------------------------- Log.Write(JobName + "任务执行结束![共计" + List.Count + "条]"); } catch (Exception Ex) { Log.Write(JobName + "任务执行过程出错!", Ex); } IsRun = false; } else { Log.Write(JobName + "任务还在执行中!"); } } }
public void XLSDo(OrderHouse OrderHouse, EFPagingInfo <OrderHouse> p) { if (OrderHouse.AddTime.IsNullOrEmpty()) { OrderHouse.AddTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); } if (OrderHouse.FTime.IsNullOrEmpty()) { //OrderHouse.FTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); OrderHouse.FTime = DateTime.Now; } if (!OrderHouse.AddTime.IsNullOrEmpty() && !OrderHouse.FTime.IsNullOrEmpty()) { // OrderHouse.FTime = ((DateTime)OrderHouse.FTime).AddDays(1); p.SqlWhere.Add(f => f.AddTime > OrderHouse.AddTime && f.AddTime < OrderHouse.FTime); } //if (!OrderHouse.UId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.UId == OrderHouse.UId); } if (!OrderHouse.HouseOwner.IsNullOrEmpty()) { IList <Users> UList = Entity.Users.Where(n => n.TrueName.Contains(OrderHouse.HouseOwner) || n.NeekName.Contains(OrderHouse.HouseOwner) || n.UserName == OrderHouse.HouseOwner).ToList(); List <int> UIds = new List <int>(); foreach (var pp in UList) { UIds.Add(pp.Id); } p.SqlWhere.Add(f => UIds.Contains(f.UId)); } if (!OrderHouse.OId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.OId == OrderHouse.OId); } if (!OrderHouse.Agent.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.Agent == OrderHouse.Agent); } if (!OrderHouse.TrunType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TrunType == (OrderHouse.TrunType == 99 ? 0 : OrderHouse.TrunType)); } if (!OrderHouse.AId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AId == OrderHouse.AId); } if (!OrderHouse.FId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.FId == OrderHouse.FId); } if (!OrderHouse.AgentState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AgentState == OrderHouse.AgentState); } p.SqlWhere.Add(f => f.OrderState == 2 && f.PayState == 1 && f.FState == 0); p.PageSize = 99999999; p.OrderByList.Add("Id", "DESC"); IPageOfItems <OrderHouse> OrderHouseList = Entity.Selects <OrderHouse>(p); if (OrderHouseList.Count() > 0) { //当前导出缩合表,民生跨行,工行,民生同行 int BankIdMS = 13; //民生ID int BankIdGS = 1; //工商Id string BankNameMS = Entity.BasicBank.FirstOrNew(n => n.Id == BankIdMS).Name; string BankNameGS = Entity.BasicBank.FirstOrNew(n => n.Id == BankIdGS).Name; //加载对应银行模板 string tempname = "bank.xlsx"; string file = Server.MapPath("/template") + "\\" + tempname; ExcelPackage package = new ExcelPackage(new FileInfo(file), true); //民生 IList <OrderHouse> ListMS = OrderHouseList.Where(n => n.Bank == BankNameMS).ToList(); //工商 IList <OrderHouse> ListGS = OrderHouseList.Where(n => n.Bank == BankNameGS).ToList(); //其它 IList <OrderHouse> ListOT = OrderHouseList.Where(n => n.Bank != BankNameMS && n.Bank != BankNameGS).ToList(); //设置数据开始行 int Befor = 0; int maxCol = 0;//最大列数 if (ListOT.Count > 0) { //加载模板第一张表 var sheet = package.Workbook.Worksheets[1]; var cells = sheet.Cells; decimal TotalMoney = 0; //计算总金额 int Rows = ListOT.Count(); Befor = 5; //民生他行从5开始 sheet.InsertRow(Befor + 1, Rows - 1, Befor); int i = Befor; foreach (var item in ListOT) { string zdlx = "2"; decimal Money = item.PayMoney; TotalMoney += Money; //制单类型 cells["A" + i].Value = zdlx.ToString(); //企业自制凭证号 cells["B" + i].Value = item.Id.ToString().PadLeft(8, '0'); //客户号 cells["C" + i].Value = "2200488356"; //预约标志 cells["D" + i].Value = "0"; //付款账号 cells["E" + i].Value = "613111800"; //交易金额 cells["F" + i].Value = Money; //收款账号 cells["G" + i].Value = item.CardNum; //收款人姓名 cells["H" + i].Value = item.HouseOwner; //收款账户类型 cells["I" + i].Value = "1"; //子客户号 cells["J" + i].Value = ""; //子付款账号 cells["K" + i].Value = ""; //子付款账户名 cells["L" + i].Value = ""; //子付款账户开户行名 cells["M" + i].Value = ""; //用途 cells["N" + i].Value = "房租"; //汇路 cells["O" + i].Value = Money > 50000 ? "7" : "6"; //是否通知收款人 cells["P" + i].Value = "0"; //手机 cells["Q" + i].Value = item.Mobile; //邮箱 cells["R" + i].Value = ""; //支付行号&支付行名称 cells["S" + i].Value = item.Bin + "&" + item.Deposit; maxCol = 19; i++; } i--; //审核方式(文件类型) cells["B1"].Value = "1"; //总金额 cells["B2"].Value = TotalMoney.ToString("F2"); //总交易数 cells["B3"].Value = Rows.ToString(); sheet.Cells[Befor, 6, i, 6].Style.Numberformat.Format = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)"; } if (ListMS.Count > 0) { //加载模板第二张表 var sheet = package.Workbook.Worksheets[2]; var cells = sheet.Cells; decimal TotalMoney = 0; //计算总金额 int Rows = ListMS.Count(); Befor = 9; //民生本行从9开始 sheet.InsertRow(Befor + 1, Rows - 1, Befor); int i = Befor; foreach (var item in ListMS) { decimal Money = item.PayMoney; TotalMoney += Money; //收款账号 cells["A" + i].Value = item.CardNum; //交易金额 cells["B" + i].Value = Money.ToString("F2"); //收款人姓名 cells["C" + i].Value = item.HouseOwner; //用途 cells["D" + i].Value = "349"; maxCol = 4; i++; } i--; //总金额 cells["B6"].Value = TotalMoney.ToString(); //总交易数 cells["B7"].Value = Rows.ToString(); } if (ListGS.Count > 0) { //加载模板第三张表 var sheet = package.Workbook.Worksheets[3]; var cells = sheet.Cells; decimal TotalMoney = 0; //计算总金额 int Rows = ListGS.Count(); Befor = 2; //工行本行从2开始 sheet.InsertRow(Befor + 1, Rows - 1, Befor); int i = Befor; IList <BasicProvince> PList = Entity.BasicProvince.Where(n => n.State == 1).ToList(); IList <BasicCity> CList = Entity.BasicCity.Where(n => n.State == 1).ToList(); foreach (var item in ListGS) { decimal Money = item.PayMoney; TotalMoney += Money; //币种 cells["A" + i].Value = "RMB"; //日期 cells["B" + i].Value = DateTime.Now.ToString("yyyyMMdd"); //明细标志 cells["C" + i].Value = ""; //顺序号 cells["D" + i].Value = i - Befor + 1; //付款账号开户行 cells["E" + i].Value = "工商银行"; //付款账号 cells["F" + i].Value = "4000051709100125887"; //付款账号名称 cells["G" + i].Value = "好付支付(深圳)有限公司"; //收款账号开户行 cells["H" + i].Value = "工商银行"; //收款账号省份 cells["I" + i].Value = PList.FirstOrNew(n => n.Id == item.Province).Name; //收款账号地市 cells["J" + i].Value = CList.FirstOrNew(n => n.Id == item.City).Name; //收款账号地区码 cells["K" + i].Value = ""; //收款账号 cells["L" + i].Value = item.CardNum; //收款账号名称 cells["M" + i].Value = item.HouseOwner; //金额 cells["N" + i].Value = Money.ToString("F2"); //汇款用途 cells["O" + i].Value = "房租"; //备注信息 cells["P" + i].Value = ""; //汇款方式 cells["Q" + i].Value = 1; //收款账户短信通知手机号码 cells["R" + i].Value = ""; //自定义序号 cells["S" + i].Value = item.Id; maxCol = 19; i++; } i--; } //无数据表删除 if (ListGS.Count == 0) { package.Workbook.Worksheets.Delete(package.Workbook.Worksheets[3]); } if (ListMS.Count == 0) { package.Workbook.Worksheets.Delete(package.Workbook.Worksheets[2]); } if (ListOT.Count == 0) { package.Workbook.Worksheets.Delete(package.Workbook.Worksheets[1]); } Response.BinaryWrite(package.GetAsByteArray());//输出 Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(10, 99) + ".xlsx"); } else { Response.Write("暂无符合条件数据"); } }
public ActionResult Index(OrderHouse OrderHouse, EFPagingInfo <OrderHouse> p, bool?IsShowSupAgent, int IsFirst = 0) { if (IsShowSupAgent == null) { IsShowSupAgent = false; } if (Request.QueryString["PageSize"].IsNullOrEmpty()) { p.PageSize = 30; } p.SqlWhere.Add(f => f.OrderState == 2); p.SqlWhere.Add(f => f.PayState == 1 || f.PayState == 2); //if (OrderHouse.AddTime.IsNullOrEmpty()) //{ // OrderHouse.AddTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //} //if (OrderHouse.FTime.IsNullOrEmpty()) //{ // OrderHouse.FTime = DateTime.Now; //} if (IsFirst == 0) { PageOfItems <OrderHouse> OrderHouseList1 = new PageOfItems <OrderHouse>(new List <OrderHouse>(), 0, 10, 0, new Hashtable()); ViewBag.OrderHouseList = OrderHouseList1; ViewBag.OrderHouse = OrderHouse; ViewBag.UsersList = new List <Users>(); ViewBag.SysAgentList = Entity.SysAgent.Where(n => n.State == 1 && n.Tier == 1).ToList(); ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.Edit = this.checkPower("Edit"); ViewBag.Cancel = this.checkPower("Cancel"); ViewBag.Save = this.checkPower("Save"); return(View()); } //if (!OrderHouse.UId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.UId == OrderHouse.UId); } if (!OrderHouse.HouseOwner.IsNullOrEmpty()) { IList <Users> UList = Entity.Users.Where(n => n.TrueName.Contains(OrderHouse.HouseOwner) || n.NeekName.Contains(OrderHouse.HouseOwner) || n.UserName == OrderHouse.HouseOwner).ToList(); List <int> UIds = new List <int>(); foreach (var pp in UList) { UIds.Add(pp.Id); } p.SqlWhere.Add(f => UIds.Contains(f.UId)); } if (!OrderHouse.OId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.OId == OrderHouse.OId); } if (!OrderHouse.Agent.IsNullOrEmpty()) { //是否要显示下级 if ((bool)IsShowSupAgent) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == OrderHouse.Agent).FirstOrNew(); IList <SysAgent> SysAgentList = LowerLevelAgent.GetSupAgent(Entity); IList <int> UID = new List <int>(); foreach (var s in SysAgentList) { UID.Add(s.Id); } p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == OrderHouse.Agent); } } if (!OrderHouse.FState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.FState == (OrderHouse.FState == 99 ? 0 : OrderHouse.FState)); } if (!OrderHouse.TrunType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TrunType == (OrderHouse.TrunType == 99 ? 0 : OrderHouse.TrunType)); } if (!OrderHouse.AId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AId == OrderHouse.AId); } if (!OrderHouse.FId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.FId == OrderHouse.FId); } if (!OrderHouse.AgentState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AgentState == OrderHouse.AgentState); } if (!OrderHouse.AddTime.IsNullOrEmpty() && !OrderHouse.FTime.IsNullOrEmpty()) { // DateTime FTime = ((DateTime)OrderHouse.FTime).AddDays(1); DateTime FTime = OrderHouse.FTime.Value; p.SqlWhere.Add(f => f.PayTime > OrderHouse.AddTime && f.PayTime < FTime); } p.OrderByList.Add("Id", "DESC"); IPageOfItems <OrderHouse> OrderHouseList = null; if (IsFirst == 0) { OrderHouseList = new PageOfItems <OrderHouse>(new List <OrderHouse>(), 0, 10, 0, new Hashtable()); } else { OrderHouseList = Entity.Selects <OrderHouse>(p); } ViewBag.OrderHouseList = OrderHouseList; ViewBag.OrderHouse = OrderHouse; IList <OrderHouse> List = OrderHouseList.GroupBy(n => n.UId).Select(n => n.First()).ToList(); List <int> UId = new List <int>(); foreach (var pp in List) { UId.Add(pp.UId); } ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && UId.Contains(n.Id)).ToList(); ViewBag.SysAgentList = Entity.SysAgent.Where(n => n.Tier == 1).ToList(); ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.Edit = this.checkPower("Edit"); ViewBag.Cancel = this.checkPower("Cancel"); ViewBag.Save = this.checkPower("Save"); return(View()); }
public void XLSDo(Orders Orders, EFPagingInfo <Orders> p, bool?IsShowSupAgent, int TimeType = 1) { if (IsShowSupAgent == null) { IsShowSupAgent = false; } p = this.Condition(Orders, p, IsShowSupAgent, TimeType); p.PageSize = 99999999; p.OrderByList.Add("Id", "DESC"); IPageOfItems <Orders> OrdersList = Entity.Selects <Orders>(p); if (OrdersList.Count() > 0) { #region 导出 string file = Server.MapPath("/template") + "\\finorders.xlsx"; ExcelPackage package = new ExcelPackage(new FileInfo(file), true); var sheet = package.Workbook.Worksheets[1]; var cells = sheet.Cells; int Rows = OrdersList.Count(); //设置数据开始行 int Befor = 2; sheet.InsertRow(Befor + 1, Rows - 1, Befor); int i = Befor; sheet.Row(i - 1).Height = 22;//设置行高 int maxCol = 0; //获取机构及管理员 IList <Orders> List = OrdersList.GroupBy(n => n.UId).Select(n => n.First()).ToList(); List <int> UId = new List <int>(); foreach (var pp in List) { UId.Add(pp.UId); } IList <Users> UsersList = Entity.Users.Where(n => n.State == 1 && UId.Contains(n.Id)).ToList(); IList <PayConfig> PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); IList <SysAgent> SysAgentList = Entity.SysAgent.ToList(); foreach (var item in OrdersList) { #region MyRegion string AName = "--"; if (item.AId > 0) { SysAgent SA = SysAgentList.FirstOrNew(n => n.Id == item.Agent); if (!SA.Name.IsNullOrEmpty()) { AName = SA.Name; } } string BName = "--"; Users OU = UsersList.FirstOrNew(n => n.Id == item.UId); if (!OU.TrueName.IsNullOrEmpty()) { BName = OU.TrueName; } PayConfig PayConfig = PayConfigList.FirstOrNew(n => n.Id == item.PayWay); sheet.Row(i).Height = 22;//设置行高 //机构 cells["A" + i].Value = AName; //交易号 cells["B" + i].Value = item.TNum; //交易商户 cells["C" + i].Value = OU.NeekName + "[" + OU.TrueName + "]"; //交易类型 cells["D" + i].Value = item.GetTTName(); //交易内容 cells["E" + i].Value = item.GetPayNameWithTName(); //交易金额 cells["F" + i].Value = item.Amoney.ToString("f2"); //交易时间 cells["G" + i].Value = item.PayTime; //入账时间 cells["H" + i].Value = (item.InTimed != null?Convert.ToDateTime(item.InTimed).ToString():""); //支付方式 cells["I" + i].Value = PayConfig.Name; //订单状态 cells["J" + i].Value = item.GetState(); string temp = string.Empty; if (item.TType == 2 || item.TType == 5) { temp = "T+" + item.TrunType; } if (item.TType == 1 || item.TType == 7 || item.TType == 8 || item.TType == 9) { temp = "T+" + item.LagEntryDay; } //接收方式 cells["K" + i].Value = temp; double I = 0, K = 0, N = 0; decimal J = 0, L = 0, M = 0; string Is = ""; #region MyRegion if (item.TType == 1) { //银联卡支付订单 OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == item.TNum); I = OrderRecharge.UserRate; //商户费率 J = OrderRecharge.Poundage; //手续费 K = OrderRecharge.SysRate; //第三方费率 L = ((decimal)OrderRecharge.SysRate * OrderRecharge.Amoney).Ceiling(); //第三方手续费 N = OrderRecharge.AgentPayGet; //分支机构提成 M = OrderRecharge.Poundage - (decimal)OrderRecharge.SysRate * OrderRecharge.Amoney - (decimal)OrderRecharge.AgentPayGet; //利润 } if (item.TType == 2) { //提现订单 OrderCash OrderCash = Entity.OrderCash.FirstOrNew(n => n.OId == item.TNum); I = 0; if (!OrderCash.ECash.IsNullOrEmpty() && !OrderCash.Cash.IsNullOrEmpty()) { Is = OrderCash.ECash.ToMoney() + "+" + (OrderCash.Cash * 100).ToString("F2") + "%"; } else if (!OrderCash.ECash.IsNullOrEmpty()) { Is = OrderCash.ECash.ToMoney(); } else if (!OrderCash.Cash.IsNullOrEmpty()) { Is = (OrderCash.Cash * 100).ToString("F2") + "%"; } else { Is = "0"; } J = (decimal)OrderCash.UserRate; //手续费 K = 0; //第三方费率 L = OrderCash.CashRate; //第三方手续费 N = OrderCash.AgentCashGet; //分支机构提成 M = (decimal)OrderCash.UserRate - OrderCash.CashRate - (decimal)OrderCash.AgentCashGet; //利润 } if (item.TType == 3) { //转帐订单 OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == item.TNum); I = OrderTransfer.UserRate; //商户费率 J = OrderTransfer.Poundage; //手续费 K = OrderTransfer.SysRate; //第三方费率 L = ((decimal)OrderTransfer.SysRate * OrderTransfer.Amoney).Ceiling(); //第三方手续费 N = OrderTransfer.AgentPayGet; //分支机构提成 M = OrderTransfer.Amoney - OrderTransfer.PayMoney - L - (decimal)OrderTransfer.AgentPayGet; //利润 } if (item.TType == 5) { //付房租订单 OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == item.TNum); I = OrderHouse.UserRate + (double)OrderHouse.CashRate; //商户费率 J = OrderHouse.Poundage; //手续费 K = OrderHouse.SysRate; //第三方费率 L = ((decimal)OrderHouse.SysRate * OrderHouse.Amoney).Ceiling(); //第三方手续费 N = OrderHouse.AgentPayGet; //分支机构提成 M = OrderHouse.Amoney - OrderHouse.PayMoney - L - (decimal)OrderHouse.AgentPayGet; //利润 } if (item.TType == 6) { //升级订单 PayConfigOrder PayConfigOrder = Entity.PayConfigOrder.FirstOrNew(n => n.OId == item.TNum); I = 0; //商户费率 J = PayConfigOrder.Poundage; //手续费 K = PayConfigOrder.SysRate; //第三方费率 L = ((decimal)PayConfigOrder.SysRate * PayConfigOrder.Amoney).Ceiling(); //第三方手续费 N = PayConfigOrder.AgentGet; //分支机构提成 M = PayConfigOrder.Amoney - (decimal)PayConfigOrder.AgentGet; //利润 } if (item.TType == 7 || item.TType == 8 || item.TType == 9) { //当面付 OrderF2F OrderF2F = Entity.OrderF2F.FirstOrNew(n => n.OId == item.TNum); I = OrderF2F.UserRate; //商户费率 J = OrderF2F.Poundage; //手续费 K = OrderF2F.SysRate; //第三方费率 L = ((decimal)OrderF2F.SysRate * OrderF2F.Amoney).Ceiling(); //第三方手续费 N = OrderF2F.AgentPayGet; //分支机构提成 M = OrderF2F.Poundage - (decimal)OrderF2F.SysRate * OrderF2F.Amoney - (decimal)OrderF2F.AgentPayGet; //利润 } if (item.TType == 10) { //升级订单 DaiLiOrder DaiLiOrder = Entity.DaiLiOrder.FirstOrNew(n => n.OId == item.TNum); I = 0; //商户费率 J = 0; //手续费 K = 0; //第三方费率 L = 0; //第三方手续费 N = DaiLiOrder.AgentGet; //分支机构提成 M = DaiLiOrder.Amoney - (decimal)DaiLiOrder.AgentGet; //利润 } #endregion //用户费率9 if (item.TType == 2) { cells["L" + i].Value = Is; } else { cells["L" + i].Value = I; } //用户手续费10 cells["M" + i].Value = J; //支出费率11 系统费率 cells["N" + i].Value = K; //支出手续费12 cells["O" + i].Value = L; //利润13 cells["P" + i].Value = M; //结算金额14 cells["Q" + i].Value = N; i++; #endregion } sheet.Row(i).Height = 40;//设置行高 //交易总额 cells["F" + i].Formula = "SUM(F" + Befor + ":F" + (i - 1) + ")"; //用户手续费10 cells["M" + i].Formula = "SUM(M" + Befor + ":M" + (i - 1) + ")"; //支出手续费12 cells["O" + i].Formula = "SUM(O" + Befor + ":O" + (i - 1) + ")"; //利润13 cells["P" + i].Formula = "SUM(P" + Befor + ":P" + (i - 1) + ")"; //结算金额14 cells["Q" + i].Formula = "SUM(Q" + Befor + ":Q" + (i - 1) + ")"; i--; maxCol = 17; //cells["B" + (i + 2)].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); sheet.Cells[Befor, 1, i, maxCol].Style.Border.Left.Style = ExcelBorderStyle.Thin; sheet.Cells[Befor, 1, i, maxCol].Style.Border.Right.Style = ExcelBorderStyle.Thin; sheet.Cells[Befor, 1, i, maxCol].Style.Border.Top.Style = ExcelBorderStyle.Thin; sheet.Cells[Befor, 1, i, maxCol].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; sheet.Cells[Befor, 1, i, maxCol].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;//居中 sheet.Cells[Befor, 7, i, 7].Style.Numberformat.Format = "yyyy-mm-dd HH:mm:ss"; sheet.Cells[Befor, 8, i, 8].Style.Numberformat.Format = "yyyy-mm-dd HH:mm:ss"; sheet.Cells[Befor, 12, i, 12].Style.Numberformat.Format = "#0.00%"; sheet.Cells[Befor, 14, i, 14].Style.Numberformat.Format = "#0.00%"; i++; sheet.Cells[Befor, 6, i, 6].Style.Numberformat.Format = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)"; sheet.Cells[Befor, 13, i, 13].Style.Numberformat.Format = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)"; sheet.Cells[Befor, 15, i, 15].Style.Numberformat.Format = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)"; sheet.Cells[Befor, 16, i, 16].Style.Numberformat.Format = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)"; sheet.Cells[Befor, 17, i, 17].Style.Numberformat.Format = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)"; Response.BinaryWrite(package.GetAsByteArray()); //输出 Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(10, 99) + ".xlsx"); #endregion } else { Response.Write("暂无符合条件数据"); } }
public void Post() { string Data = DataObj.GetData(); if (Data.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Data); } catch (Exception Ex) { Log.Write("[Orders]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } Orders Orders = new Orders(); Orders = JsonToObject.ConvertJsonToModel(Orders, json); Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Orders.Token); if (baseUsers == null)//用户令牌不存在 { DataObj.OutError("2004"); return; } if (baseUsers.State != 1)//用户被锁定 { DataObj.OutError("2003"); return; } if (baseUsers.CardStae != 2)//未实名认证 { DataObj.OutError("2006"); return; } if (baseUsers.MiBao != 1)//未设置支付密码 { DataObj.OutError("2008"); return; } Orders = Entity.Orders.FirstOrDefault(n => n.TNum == Orders.TNum && (n.UId == baseUsers.Id || (n.RUId == baseUsers.Id && n.PayState == 1))); if (Orders == null)//不存在 { DataObj.OutError("1001"); return; } if (Orders.RUId == baseUsers.Id) { Orders.TType = 4; } Orders.DoRemark(Entity); Orders.StateTxt = Orders.GetState(); String Out = Orders.ToStr(); if (Orders.TType == 1) { //银联卡支付 OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == Orders.TNum); OrderRecharge.Cols = "Amoney,PayMoney,Poundage,PayType"; Out = Out + "," + OrderRecharge.ToStr(); } if (Orders.TType == 2)//提现不能取消 { OrderCash OrderCash = Entity.OrderCash.FirstOrNew(n => n.OId == Orders.TNum); OrderCash.Cols = "Owner,Bank,CardNum,Deposit,Mobile,Province,City,District,Amoney,UserRate"; Out = Out + "," + OrderCash.ToStr(); } if (Orders.TType == 3 || Orders.TType == 4)//付款 { OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == Orders.TNum); OrderTransfer.Cols = "UId,RUId,PayMoney,Poundage,Amoney"; Out = Out + "," + OrderTransfer.ToStr(); } if (Orders.TType == 5)//防租 { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == Orders.TNum); OrderHouse.Cols = "HouseOwner,Bank,CardNum,Deposit,Mobile,MonthRent,SecurityMoney,PayMonth,Poundage,Amoney"; Out = Out + "," + OrderHouse.ToStr(); } if (Orders.TType == 6) { //升级 //PayConfigOrder PayConfigOrder = Entity.PayConfigOrder.FirstOrNew(n => n.OId == Orders.TNum); //Out = Out + "," + PayConfigOrder.ToStr(); } if (Orders.TType == 7 || Orders.TType == 8 || Orders.TType == 9) { //扫码 OrderF2F OrderF2F = Entity.OrderF2F.FirstOrNew(n => n.OId == Orders.TNum); OrderF2F.Cols = "Amoney,PayMoney,Poundage"; Out = Out + "," + OrderF2F.ToStr(); } if (Orders.TType == 10) { //代理 } Out = "{" + Out + "}"; DataObj.Data = Out; DataObj.Code = "0000"; DataObj.OutString(); }
public void Post() { string Data = DataObj.GetData(); if (Data.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Data); } catch (Exception Ex) { Log.Write("[OrderHouse]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } OrderHouse OrderHouse = new OrderHouse(); OrderHouse = JsonToObject.ConvertJsonToModel(OrderHouse, json); UserTrack UserTrack = new UserTrack(); UserTrack = JsonToObject.ConvertJsonToModel(UserTrack, json); string Tag = "House"; SysControl SysControl = Entity.SysControl.FirstOrDefault(n => n.Tag == Tag); SysControl syscontrol = SysControl.ChkState(); if (syscontrol.State != 1) { DataObj.OutError("1005"); return; } //获取用户信息 Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == OrderHouse.Token); if (baseUsers == null)//用户令牌不存在 { DataObj.OutError("2004"); return; } if (baseUsers.State != 1)//用户被锁定 { DataObj.OutError("2003"); return; } if (baseUsers.CardStae != 2)//未实名认证 { DataObj.OutError("2006"); return; } if (baseUsers.MiBao != 1)//未设置支付密码 { DataObj.OutError("2008"); return; } //开始处理参数 if (OrderHouse.HouseOwner.IsNullOrEmpty() || OrderHouse.Bank.IsNullOrEmpty() || OrderHouse.Deposit.IsNullOrEmpty() || OrderHouse.CardNum.IsNullOrEmpty() || OrderHouse.Mobile.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } if (OrderHouse.MonthRent.IsNullOrEmpty() || OrderHouse.PayMonth.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } if (OrderHouse.X.IsNullOrEmpty() || OrderHouse.Y.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } if (OrderHouse.AId.IsNullOrEmpty()) {//支付方式,用于取出支付费率信息,计算各接口金额 DataObj.OutError("1000"); return; } if (OrderHouse.AId == 4) {//支付方式,用于取出支付费率信息,计算各接口金额 DataObj.OutError("6022"); return; } if (OrderHouse.SecurityMoney.IsNullOrEmpty()) { OrderHouse.SecurityMoney = 0; } //获取用户支付配置 //UserPay UserPay = Entity.UserPay.FirstOrDefault(n => n.UId == baseUsers.Id && n.PId == OrderHouse.AId); //if (UserPay == null) { // DataObj.OutError("1000"); // return; //} OrderHouse.SecurityMoney = OrderHouse.SecurityMoney.FormatMoney(); OrderHouse.MonthRent = OrderHouse.MonthRent.FormatMoney(); //获取系统支付配置 PayConfig PayConfig = Entity.PayConfig.FirstOrDefault(n => n.Id == OrderHouse.AId && n.State == 1); if (PayConfig == null) { DataObj.OutError("1000"); return; } //获取分支机构信息 SysAgent SysAgent = new SysAgent(); if (!baseUsers.Agent.IsNullOrEmpty()) { SysAgent = Entity.SysAgent.FirstOrNew(n => n.Id == baseUsers.Agent); } //获取系统配置 SysSet SysSet = Entity.SysSet.FirstOrDefault(); if (OrderHouse.TrunType.IsNullOrEmpty()) { OrderHouse.TrunType = 0; } if (OrderHouse.TrunType != 0) { OrderHouse.TrunType = 1; } decimal Peier = 0; if (OrderHouse.TrunType == 0) { if (baseUsers.HasT0 != 1) { //T0黑名单 DataObj.OutError("6020"); return; } //验证是否满足T0 int Day = (DateTime.Now - baseUsers.AddTime).Days; int OrderCount = Entity.Orders.Count(n => (n.TType == 2 || n.TType == 5) && n.PayState == 2 && n.UId == baseUsers.Id); decimal?OrderMoney = Entity.Orders.Where(n => (n.TType == 2 || n.TType == 5) && n.PayState == 2 && n.UId == baseUsers.Id).Sum(n => (decimal?)n.Amoney); if (OrderMoney.IsNullOrEmpty()) { OrderMoney = 0; } if (Day >= SysSet.CashDay && OrderCount >= SysSet.CashNum && OrderMoney >= SysSet.CashMoney) { } else { DataObj.OutError("6020"); return; } //验证是否在快速提现时段内 TaskTimeSet TaskTimeSet = Entity.TaskTimeSet.FirstOrDefault(n => n.STime <= DateTime.Now && n.ETime >= DateTime.Now && n.TId == 1); if (TaskTimeSet == null) { DataObj.OutError("6018"); return; } Peier = TaskTimeSet.AllMoney - TaskTimeSet.UsedMoney; } OrderHouse.UId = baseUsers.Id; double House = SysSet.House; double Cost = (double)PayConfig.Cost; //余额支付不收手续费 if (PayConfig.DllName == "Cash") { House = 0; Cost = 0; } if (OrderHouse.TrunType == 0) { //总房租=月租金*月数+压金 OrderHouse.PayMoney = OrderHouse.MonthRent * OrderHouse.PayMonth + OrderHouse.SecurityMoney; //手续费=总房租*(付房租系统费率+加急费率)+提现服务费 OrderHouse.Poundage = OrderHouse.PayMoney * ((decimal)House + baseUsers.Cash0) + baseUsers.ECash0; //手续费进位 OrderHouse.Poundage = OrderHouse.Poundage.Ceiling(); //总付款金额=房租+手续费 OrderHouse.Amoney = OrderHouse.PayMoney + OrderHouse.Poundage; //第三方支付通道率 OrderHouse.SysRate = Cost; //商户费率 OrderHouse.UserRate = House; //提现费率 OrderHouse.CashRate = OrderHouse.PayMoney * SysSet.Cash0 + SysSet.ECash0; //这里是利润计算========== //利润=总支付金额-房租-支付手续费-提现服务费 decimal GetAll = OrderHouse.Poundage - OrderHouse.PayMoney * ((decimal)Cost + SysSet.Cash0) - baseUsers.ECash0; //利润舍位 GetAll = GetAll.Floor(); //总利润 OrderHouse.AIdPayGet = (double)GetAll; //分支机构佣金设置为0,待分润计算后再写入 OrderHouse.AgentPayGet = 0; } else { //总房租=月租金*月数+压金 OrderHouse.PayMoney = OrderHouse.MonthRent * OrderHouse.PayMonth + OrderHouse.SecurityMoney; //手续费=总房租*付房租系统费率 OrderHouse.Poundage = OrderHouse.PayMoney * ((decimal)House + baseUsers.Cash1) + baseUsers.ECash1; //总付款金额=房租+手续费 OrderHouse.Amoney = OrderHouse.PayMoney + OrderHouse.Poundage; //第三方支付通道率 OrderHouse.SysRate = Cost; //商户费率 OrderHouse.UserRate = House; //提现服务费--T+1无手续费 OrderHouse.CashRate = OrderHouse.PayMoney * SysSet.Cash1 + SysSet.ECash1; //这里是利润计算========== //利润=总支付金额-房租-支付手续费 decimal GetAll = OrderHouse.Poundage - OrderHouse.Amoney * ((decimal)Cost + SysSet.Cash1) - baseUsers.ECash1; //总利润 OrderHouse.AIdPayGet = (double)GetAll; //分支机构佣金设置为0,待分润计算后再写入 OrderHouse.AgentPayGet = 0; } if (OrderHouse.TrunType == 0)//T0时才验证 { //需要支付房东金额 decimal TotalPrice = OrderHouse.PayMoney; //验证是否配额充足 if (Peier < TotalPrice) { DataObj.OutError("6019"); return; } } OrderHouse.Agent = SysAgent.Id;//分支机构Id OrderHouse.AId = baseUsers.AId; OrderHouse.FId = 0; OrderHouse.OrderState = 1; OrderHouse.PayState = 0; OrderHouse.AgentState = 0; OrderHouse.FState = 0; OrderHouse.AddTime = DateTime.Now; //写入前,判断交易金额限制 if (OrderHouse.Amoney < syscontrol.SNum || OrderHouse.Amoney > syscontrol.ENum) { DataObj.OutError("1006"); return; } //写入订单总表 Orders Orders = new Orders(); Orders.Remark = OrderHouse.Remark; Orders.UId = OrderHouse.UId; Orders.TName = OrderHouse.HouseOwner + "的房租"; Orders.PayType = 0; Orders.PayName = "房租"; Orders.RUId = 0; Orders.RName = string.Empty; Orders.TType = 5; Orders.TState = 1; Orders.Amoney = OrderHouse.Amoney; Orders.Poundage = OrderHouse.Poundage; Orders.AddTime = DateTime.Now; Orders.PayState = 0; Orders.PayWay = PayConfig.Id; Orders.Agent = OrderHouse.Agent; Orders.AgentState = 0; Orders.AId = OrderHouse.AId; Orders.FId = 0; string OrderAddress = OrderHouse.OrderAddress; if (OrderAddress.IsNullOrEmpty()) { OrderAddress = Utils.GetAddressByGPS(OrderHouse.X, OrderHouse.Y); } Orders.OrderAddress = OrderAddress; Orders.X = OrderHouse.X; Orders.Y = OrderHouse.Y; Orders.TrunType = OrderHouse.TrunType; Entity.Orders.AddObject(Orders); Entity.SaveChanges(); Entity.Refresh(RefreshMode.StoreWins, Orders); OrderHouse.OId = Orders.TNum; Entity.OrderHouse.AddObject(OrderHouse); Entity.SaveChanges(); //======================================= UserTrack.ENo = DataObj.ENo; UserTrack.OPType = Orders.PayName; UserTrack.UserName = Orders.TNum; UserTrack.GPSAddress = Orders.OrderAddress; UserTrack.GPSX = Orders.X; UserTrack.GPSY = Orders.Y; Orders.SeavGPSLog(UserTrack, Entity); //======================================= Orders.SendMsg(Entity);//发送消息类 DataObj.Data = Orders.OutJson(); DataObj.Code = "0000"; DataObj.OutString(); }
public void Post() { string Data = DataObj.GetData(); if (Data.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Data); } catch (Exception Ex) { Log.Write("[Orders]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } //System.Threading.Thread.Sleep(1000 * 150); Orders Orders = new Orders(); Orders = JsonToObject.ConvertJsonToModel(Orders, json); Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Orders.Token); if (baseUsers == null)//用户令牌不存在 { DataObj.OutError("2004"); return; } if (baseUsers.State != 1)//用户被锁定 { DataObj.OutError("2003"); return; } if (baseUsers.CardStae != 2)//未实名认证 { //DataObj.OutError("2006"); //return; } //if (baseUsers.MiBao != 1)//未设置支付密码 //{ // DataObj.OutError("2008"); // return; //} Orders = Entity.Orders.FirstOrDefault(n => n.TNum == Orders.TNum && (n.UId == baseUsers.Id || (n.RUId == baseUsers.Id && n.PayState == 1))); if (Orders == null)//不存在 { DataObj.OutError("1001"); return; } if (Orders.RUId == baseUsers.Id) { Orders.TType = 4; } Orders.DoRemark(Entity); Orders.StateTxt = Orders.GetState(); Orders.Cols += ",Json,PicList,UserCardName,CardUpdateTime"; Orders.DoRemark(Entity); Orders.Colour = Orders.GeStateColour(); IList <OrdersModel> OML = Utils.GetOrdersModel(); OrdersModel OrdersModel = OML.FirstOrNew(n => n.Id == Orders.TType); Orders.Otypename = OrdersModel.Name; Orders.LagEntryDay = (byte)(Orders.TrunType.HasValue && Orders.TrunType.Value != 0 ? Orders.TrunType.Value : Orders.LagEntryDay); if (Orders.IdCardState > 1) { Orders.Remark = Orders.DDAuditRemark; } if (!Orders.UserCardPic.IsNullOrEmpty()) { var UserCardPicList = Orders.UserCardPic.Split(',').ToList(); for (int i = 0; i < UserCardPicList.Count; i++) { var a = Utils.ImageUrl("Orders", UserCardPicList[i], AppImgPath); UserCardPicList[i] = a; } JavaScriptSerializer JSS = new JavaScriptSerializer(); string data = JSS.Serialize(UserCardPicList); JArray JO = (JArray)JsonConvert.DeserializeObject(data); Orders.PicList = JO; } JObject JS = new JObject(); if (Orders.TType == 1) { //银联卡支付 OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == Orders.TNum); OrderRecharge.Cols = "Amoney,PayMoney,Poundage,PayType"; string JsStr = OrderRecharge.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } Orders.Json = JS; } if (Orders.TType == 2)//提现不能取消 { OrderCash OrderCash = Entity.OrderCash.FirstOrNew(n => n.OId == Orders.TNum); OrderCash.Cols = "Owner,Bank,CardNum,Deposit,Mobile,Province,City,District,Amoney,UserRate,TrunType,PayMoney"; OrderCash.PayMoney = OrderCash.Amoney - (decimal)OrderCash.UserRate; string JsStr = OrderCash.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } Orders.Json = JS; } if (Orders.TType == 3 || Orders.TType == 4)//付款 { OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == Orders.TNum); Users Users = new Users(); if (Orders.TType == 4) { Users = Entity.Users.FirstOrNew(n => n.Id == OrderTransfer.UId); } if (Orders.TType == 3) { Users = Entity.Users.FirstOrNew(n => n.Id == OrderTransfer.RUId); } OrderTransfer.Mobile = Users.UserName; OrderTransfer.ToUserName = Users.TrueName; OrderTransfer.Cols = "UId,RUId,PayMoney,Poundage,Amoney,Mobile,ToUserName"; string JsStr = OrderTransfer.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } Orders.Json = JS; } if (Orders.TType == 5)//防租 { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == Orders.TNum); OrderHouse.Cols = "HouseOwner,Bank,CardNum,Deposit,Mobile,MonthRent,SecurityMoney,PayMonth,Poundage,Amoney"; string JsStr = OrderHouse.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } Orders.Json = JS; } if (Orders.TType == 6) { //升级 //PayConfigOrder PayConfigOrder = Entity.PayConfigOrder.FirstOrNew(n => n.OId == Orders.TNum); //Out = Out + "," + PayConfigOrder.ToStr(); Orders.Poundage = 0; } if (Orders.TType == 7 || Orders.TType == 8 || Orders.TType == 9) { //扫码 OrderF2F OrderF2F = Entity.OrderF2F.FirstOrNew(n => n.OId == Orders.TNum); OrderF2F.Cols = "Amoney,PayMoney,Poundage"; string JsStr = OrderF2F.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } Orders.Json = JS; } if (Orders.TType == 10) { //代理 } String Out = Orders.ToStr(); Out = "{" + Out + "}"; DataObj.Data = Out; DataObj.Code = "0000"; DataObj.OutString(); }
public void Post() { string Data = DataObj.GetData(); if (Data.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Data); } catch (Exception Ex) { Log.Write("[Orders]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } Orders Orders = new Orders(); Orders = JsonToObject.ConvertJsonToModel(Orders, json); Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Orders.Token); if (baseUsers == null)//用户令牌不存在 { DataObj.OutError("2004"); return; } if (baseUsers.State != 1)//用户被锁定 { DataObj.OutError("2003"); return; } if (baseUsers.CardStae != 2)//未实名认证 { DataObj.OutError("2006"); return; } if (baseUsers.MiBao != 1)//未设置支付密码 { DataObj.OutError("2008"); return; } Orders = Entity.Orders.FirstOrDefault(n => n.TNum == Orders.TNum && n.UId == baseUsers.Id); if (Orders == null)//不存在 { DataObj.OutError("1001"); return; } if (Orders.TState != 1) { DataObj.OutError("6010"); return; } if (Orders.PayState != 0) { DataObj.OutError("6010"); return; } Orders.TState = 3; if (Orders.TType == 1) { //银联卡支付 OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == Orders.TNum); OrderRecharge.OrderState = 3; } if (Orders.TType == 2)//提现不能取消 { DataObj.OutError("6010"); return; } if (Orders.TType == 3)//付款 { OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == Orders.TNum); OrderTransfer.OrderState = 3; } if (Orders.TType == 5)//防租 { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == Orders.TNum); OrderHouse.OrderState = 3; } if (Orders.TType == 7)//不能取消 { DataObj.OutError("6010"); return; } if (Orders.TType == 8)//不能取消 { DataObj.OutError("6010"); return; } if (Orders.TType == 9)//不能取消 { DataObj.OutError("6010"); return; } Entity.SaveChanges(); Orders.SendMsg(Entity);//发送消息类 DataObj.Data = ""; DataObj.Code = "0000"; DataObj.OutString(); }
public void Post() { string Data = DataObj.GetData(); if (Data.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Data); } catch (Exception Ex) { Log.Write("[Orders]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } Orders Orders = new Orders(); Orders = JsonToObject.ConvertJsonToModel(Orders, json); Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Orders.Token); if (baseUsers == null)//用户令牌不存在 { DataObj.OutError("2004"); return; } if (baseUsers.State != 1)//用户被锁定 { DataObj.OutError("2003"); return; } if (baseUsers.CardStae != 2)//未实名认证 { //DataObj.OutError("2006"); //return; } if (baseUsers.MiBao != 1)//未设置支付密码 { //DataObj.OutError("2008"); //return; } EFPagingInfo <Orders> p = new EFPagingInfo <Orders>(); if (!Orders.Pg.IsNullOrEmpty()) { p.PageIndex = Orders.Pg; } if (!Orders.Pgs.IsNullOrEmpty()) { p.PageSize = Orders.Pgs; } if (!Orders.STime.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AddTime >= Orders.STime); } if (!Orders.ETime.IsNullOrEmpty()) { Orders.ETime = Orders.ETime.AddHours(24); p.SqlWhere.Add(f => f.AddTime <= Orders.ETime); } if (!Orders.IdCardState.IsNullOrEmpty()) {//凭证状态 if (Orders.IdCardState == 99) { p.SqlWhere.Add(f => f.IdCardState == 0); } else if (Orders.IdCardState == 98) { p.SqlWhere.Add(f => f.IdCardState == 1 || f.IdCardState == 2 || f.IdCardState == 4); } else { p.SqlWhere.Add(f => f.IdCardState == Orders.IdCardState); } } bool IsOld = true; #region 版本比较 升级之后比较长时间后可以考滤删除版本判断代码 //处理贴牌相关 var SysAgent = this.Entity.SysAgent.FirstOrDefault(o => o.Id == baseUsers.Agent); if (SysAgent == null) { DataObj.OutError("1000"); return; } var topSysAgent = SysAgent.GetTopAgent(this.Entity); if (!Equipment.SoftVer.IsNullOrEmpty()) { Version v1 = new Version(Equipment.SoftVer);//当前版本 Version v2 = new Version("1.0"); if (Equipment.RqType.ToLower() == "apple") { //苹果 if (topSysAgent.IsTeiPai == 0)//好付 { v2 = new Version("8.0"); } else//贴牌 { v2 = new Version("6.0"); } } else if (Equipment.RqType.ToLower() == "android") { //安卓 if (topSysAgent.IsTeiPai == 0)//好付 { v2 = new Version("8.0.0"); } else //贴牌 { v2 = new Version("6.0"); } } if (v1 >= v2) { IsOld = false; } } #endregion if (!IsOld)//新版 { #region 4.0条件判断 if (!(Orders.TType == 3 && Orders.TState == 3)) { p.SqlWhere.Add(o => o.UId == baseUsers.Id); } if (!Orders.TType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TType == Orders.TType);//读取对应的类型 if (Orders.TType == 1) { if (!Orders.TState.IsNullOrEmpty()) { switch (Orders.TState) { case 1: //未付 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); break; case 2: //已付 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); break; case 3: //待传证照 p.SqlWhere.Add(f => f.PayState == 1 && f.IdCardState == 1); break; case 4: //待审核/已传证照 p.SqlWhere.Add(f => f.PayState == 1 && f.IdCardState == 2); break; case 5: //审核失败 p.SqlWhere.Add(f => f.PayState == 1 && f.IdCardState == 4); break; case 6: //退单 p.SqlWhere.Add(f => f.TState == 4); break; case 7: //待入帐 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 0); break; } } } if (Orders.TType == 2) { switch (Orders.TState) { case 1: //处理中 p.SqlWhere.Add(f => f.TState == 1); break; case 2: //已汇出 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 2); break; case 3: //提现失败 p.SqlWhere.Add(f => f.TState == 3); break; case 4: //出款中 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); break; case 5: //退款 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 4); break; case 6: //退款中 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 3); break; } } if (Orders.TType == 3) { switch (Orders.TState) { case 1: //未付 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); break; case 2: //已付 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); break; case 3: //已收 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1 && f.RUId == baseUsers.Id); break; } } if (Orders.TType == 6) { if (!Orders.TState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TState == Orders.TState); } } if (Orders.TType == 7 || Orders.TType == 8) { if (!Orders.TState.IsNullOrEmpty()) { if (Orders.TState == 99) { p.SqlWhere.Add(f => f.TState == 0); } if (Orders.TState == 1) { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); } if (Orders.TState == 2) { p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); } if (Orders.TState == 3)//退单 { p.SqlWhere.Add(f => f.TState == 4); } if (Orders.TState == 4)//待入帐 { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 0); } if (Orders.TState == 5)//待审核/已传证照 { p.SqlWhere.Add(f => f.PayState == 1 && f.InState == 1 && f.IdCardState == 2); } if (Orders.TState == 6)//待传证照 { p.SqlWhere.Add(f => f.PayState == 1 && f.InState == 1 && f.IdCardState == 1); } if (Orders.TState == 7)//审核失败 { p.SqlWhere.Add(f => f.PayState == 1 && f.InState == 1 && f.IdCardState == 4); } } } } else { if (!Orders.TState.IsNullOrEmpty()) { if (Orders.TState == 99) { p.SqlWhere.Add(f => f.TState == 0); } if (Orders.TState == 1) { p.SqlWhere.Add(f => f.PayState == 1); } if (Orders.TState == 2) { p.SqlWhere.Add(f => f.PayState == 0 && f.TState != 0); } } } #endregion } else { #region 4.0之前条件判断 //搜索 if (Orders.TType.IsNullOrEmpty()) {//不限类型,读取收支交易,收款订单只显示已支付订单 p.SqlWhere.Add(f => f.UId == baseUsers.Id || (f.RUId == baseUsers.Id && f.PayState == 1) && f.TType != 2); } else { if (Orders.TType == 4) { //已支付收款订单 p.SqlWhere.Add(f => f.TType == 3); p.SqlWhere.Add(f => f.RUId == baseUsers.Id && f.PayState == 1); } else if (Orders.TType == 95) { //转帐单 p.SqlWhere.Add(f => f.TType == 3); p.SqlWhere.Add(f => (f.RUId == baseUsers.Id && f.PayState == 1) || f.UId == baseUsers.Id); } else if (Orders.TType == 96) //收款订单 { p.SqlWhere.Add(f => (f.TType == 3 && f.RUId == baseUsers.Id && f.PayState == 1) || (f.TType == 1 && f.UId == baseUsers.Id)); } else { p.SqlWhere.Add(f => f.TType == Orders.TType); p.SqlWhere.Add(f => f.UId == baseUsers.Id); } } if (!Orders.TState.IsNullOrEmpty()) //交易状态 { p.SqlWhere.Add(f => f.TState == Orders.TState); } if (!Orders.PayState.IsNullOrEmpty()) //支付状态 { if (Orders.PayState == 99) { Orders.PayState = 0; } p.SqlWhere.Add(f => f.PayState == Orders.PayState); } #endregion } p.OrderByList.Add("Id", "DESC"); IPageOfItems <Orders> List = Entity.Selects <Orders>(p); //处理转帐订单 foreach (var pp in List) { pp.Cols = pp.Cols + ",Json,PicList,UserCardName,CardUpdateTime"; if (baseUsers.Id == pp.RUId) { pp.TType = 4; } JObject JS = new JObject(); if (pp.TType == 1) { //银联卡支付 OrderRecharge OrderRecharge = Entity.OrderRecharge.FirstOrNew(n => n.OId == pp.TNum); OrderRecharge.Cols = "Amoney,PayMoney,Poundage,PayType"; string JsStr = OrderRecharge.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } pp.Json = JS; } if (pp.TType == 2)//提现不能取消 { OrderCash OrderCash = Entity.OrderCash.FirstOrNew(n => n.OId == pp.TNum); OrderCash.Cols = "Owner,Bank,CardNum,Deposit,Mobile,Province,City,District,Amoney,UserRate,TrunType,PayMoney"; OrderCash.PayMoney = OrderCash.Amoney - (decimal)OrderCash.UserRate; string JsStr = OrderCash.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } pp.Json = JS; } if (pp.TType == 3 || pp.TType == 4)//付款 { OrderTransfer OrderTransfer = Entity.OrderTransfer.FirstOrNew(n => n.OId == pp.TNum); Users Users = new Users(); if (pp.TType == 4) { Users = Entity.Users.FirstOrNew(n => n.Id == OrderTransfer.UId); } if (pp.TType == 3) { Users = Entity.Users.FirstOrNew(n => n.Id == OrderTransfer.RUId); } OrderTransfer.Mobile = Users.UserName; OrderTransfer.ToUserName = Users.TrueName; OrderTransfer.Cols = "UId,RUId,PayMoney,Poundage,Amoney,Mobile,ToUserName"; string JsStr = OrderTransfer.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } pp.Json = JS; } if (pp.TType == 5)//防租 { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrNew(n => n.OId == pp.TNum); OrderHouse.Cols = "HouseOwner,Bank,CardNum,Deposit,Mobile,MonthRent,SecurityMoney,PayMonth,Poundage,Amoney"; string JsStr = OrderHouse.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } pp.Json = JS; } if (pp.TType == 6) { //升级 //PayConfigOrder PayConfigOrder = Entity.PayConfigOrder.FirstOrNew(n => n.OId == pp.TNum); //Out = Out + "," + PayConfigOrder.ToStr(); pp.Poundage = 0; } if (pp.TType == 7 || pp.TType == 8 || pp.TType == 9) { //扫码 OrderF2F OrderF2F = Entity.OrderF2F.FirstOrNew(n => n.OId == pp.TNum); OrderF2F.Cols = "Amoney,PayMoney,Poundage"; string JsStr = OrderF2F.OutJson(); try { JS = (JObject)JsonConvert.DeserializeObject(JsStr); } catch (Exception Ex) { Log.Write("[Order]:", "【JsStr】" + JsStr, Ex); } pp.Json = JS; } if (pp.TType == 10) {//代理 } pp.DoRemark(Entity); pp.StateTxt = pp.GetState(); if (pp.RUId == baseUsers.Id && pp.PayState == 1) { pp.StateTxt = "已收"; } if (pp.IdCardState > 1) { pp.Remark = pp.DDAuditRemark; } if (!pp.Remark.IsNullOrEmpty()) { pp.Remark = pp.Remark.Replace("\t", ""); } if (!pp.UserCardPic.IsNullOrEmpty()) { var UserCardPicList = pp.UserCardPic.Split(',').ToList(); for (int i = 0; i < UserCardPicList.Count; i++) { var a = Utils.ImageUrl("Orders", UserCardPicList[i], AppImgPath); UserCardPicList[i] = a; } JavaScriptSerializer JSS = new JavaScriptSerializer(); string data = JSS.Serialize(UserCardPicList); JArray JO = (JArray)JsonConvert.DeserializeObject(data); pp.PicList = JO; } } IList <OrdersModel> OML = Utils.GetOrdersModel(); OML = OML.Where(n => n.Id != 10).ToList(); foreach (var P in OML) { if (P.Id == 3) { P.Id = 95; } } IList <Orders> iList = List.ToList(); StringBuilder sb = new StringBuilder(""); sb.Append("{"); sb.Append(List.PageToString()); sb.Append(","); sb.Append(iList.EntityToString()); sb.Append(","); sb.Append(OML.EntityToString()); sb.Append(",\"state\":{"); sb.Append("\"0\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"已付\",\"value\":\"1\"},{\"key\":\"未付\",\"value\":\"2\"}],"); sb.Append("\"1\":[{\"key\":\"未付\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"待传证照\",\"value\":\"3\"},{\"key\":\"已传证照\",\"value\":\"4\"},{\"key\":\"审核失败\",\"value\":\"5\"},{\"key\":\"退单\",\"value\":\"6\"},{\"key\":\"待入账\",\"value\":\"7\"}],"); sb.Append("\"2\":[{\"key\":\"处理中\",\"value\":\"1\"},{\"key\":\"已汇出\",\"value\":\"2\"},{\"key\":\"提现失败\",\"value\":\"3\"},{\"key\":\"出款中\",\"value\":\"4\"},{\"key\":\"已退款\",\"value\":\"5\"},{\"key\":\"退款中\",\"value\":\"6\"}],"); sb.Append("\"3\":[{\"key\":\"未付\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"已收\",\"value\":\"3\"}],"); sb.Append("\"6\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"未付\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"}],"); sb.Append("\"7\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"进行中\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"退单\",\"value\":\"3\"},{\"key\":\"待入账\",\"value\":\"4\"},{\"key\":\"已传证照\",\"value\":\"5\"},{\"key\":\"待传证照\",\"value\":\"6\"},{\"key\":\"审核失败\",\"value\":\"7\"}],"); sb.Append("\"8\":[{\"key\":\"交易关闭\",\"value\":\"99\"},{\"key\":\"进行中\",\"value\":\"1\"},{\"key\":\"已付\",\"value\":\"2\"},{\"key\":\"退单\",\"value\":\"3\"},{\"key\":\"待入账\",\"value\":\"4\"},{\"key\":\"已传证照\",\"value\":\"5\"},{\"key\":\"待传证照\",\"value\":\"6\"},{\"key\":\"审核失败\",\"value\":\"7\"}]"); sb.Append("},"); sb.Append("\"type\":[{\"key\":\"0\",\"value\":\"全部\"},{\"key\":\"1\",\"value\":\"银联卡支付\"},{\"key\":\"2\",\"value\":\"提现\"},{\"key\":\"3\",\"value\":\"转账\"},{\"key\":\"6\",\"value\":\"升级\"},{\"key\":\"7\",\"value\":\"支付宝\"},{\"key\":\"8\",\"value\":\"微信\"}]"); sb.Append("}"); DataObj.Data = sb.ToString(); DataObj.Code = "0000"; DataObj.OutString(); }
public void Notice() { string merId = ConfigurationManager.AppSettings["Cash_merId"].ToString(); //商户号 string merKey = ConfigurationManager.AppSettings["Cash_merKey"].ToString(); //商户密钥 string Resp = Request.Form["resp"]; string Sign = Request.Form["sign"]; string MD5Str = Resp + merKey; string sign = MD5Str.GetMD5(); if (Sign != sign) { Response.Write("E2"); return; } Resp = LokFuEncode.Base64Decode(Resp, "utf-8"); JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Resp); } catch (Exception Ex) { Response.Write(Ex.ToString()); return; } if (json == null) { Response.Write("Json Null"); return; } string resultcode = json["resultcode"].ToString(); //交易结果码 string resultmsg = json["resultmsg"].ToString(); //交易结果信息 string queryid = json["queryid"].ToString(); //交易流水号 string txnamt = json["txnamt"].ToString(); //交易金额\ string merid = json["merid"].ToString(); //交易金额 string orderid = json["orderid"].ToString(); //交易金额 //================================================ PayLog PayLog = new PayLog(); PayLog.PId = 0; PayLog.OId = orderid; PayLog.TId = queryid; PayLog.Amount = decimal.Parse(txnamt) / 100; PayLog.Way = "POST"; PayLog.AddTime = DateTime.Now; PayLog.Data = Request.Form.ToString(); PayLog.State = 1; Entity.PayLog.AddObject(PayLog); Entity.SaveChanges(); //================================================ if (merId != merid) { Response.Write("E1"); return; } Orders Orders = Entity.Orders.FirstOrDefault(n => n.TNum == orderid); if (Orders == null) { Response.Write("E4"); return; } if (resultcode == "0000") { if (Orders.TType == 2) { OrderCash OrderCash = Entity.OrderCash.FirstOrDefault(n => n.OId == orderid); if (OrderCash.FState == 0) { OrderCash.PayState = 2; OrderCash.FState = 1; OrderCash.FTime = DateTime.Now; Orders.PayState = 2; if (OrderCash.AgentCashGet > 0) { Orders.RunSplit = 1; } Entity.SaveChanges(); Orders.SendMsg(Entity);//发送消息类 } } if (Orders.TType == 5) { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.OId == orderid); if (OrderHouse.FState == 0) { OrderHouse.PayState = 2; OrderHouse.FState = 1; OrderHouse.FTime = DateTime.Now; Orders.PayState = 2; if (OrderHouse.AIdPayGet > 0) { Orders.RunSplit = 1; } Entity.SaveChanges(); //======分润====== Orders.SendMsg(Entity);//发送消息类 } } } else if (resultcode == "2001") { } else { if (Orders.TType == 2) { if (Orders.PayState != 4 && Orders.PayState != 3) { OrderCash OrderCash = Entity.OrderCash.FirstOrDefault(n => n.OId == orderid); OrderCash.PayState = 3; OrderCash.Remark = resultmsg; Orders.PayState = 3; Orders.Remark = resultmsg; Entity.SaveChanges(); Orders.SendMsg(Entity);//发送消息类 } } if (Orders.TType == 5) { if (Orders.PayState != 4 && Orders.PayState != 3) { OrderHouse OrderHouse = Entity.OrderHouse.FirstOrDefault(n => n.OId == orderid); OrderHouse.PayState = 3; OrderHouse.Remark = resultmsg; Orders.PayState = 3; Orders.Remark = resultmsg; Entity.SaveChanges(); Orders.SendMsg(Entity);//发送消息类 } } } Response.Write("0000"); }