public void Transfer(OrderTransfer orderTransfer) { var createTransferCommand = new CreateTransferCommand( orderTransfer.FirstName, orderTransfer.LastName, orderTransfer.PhoneNumber, orderTransfer.EventLocation, orderTransfer.Address, orderTransfer.TotalAmount ); _bus.SendCommand(createTransferCommand); }
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 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("[OrderTransfer]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } OrderTransfer OrderTransfer = new OrderTransfer(); OrderTransfer = JsonToObject.ConvertJsonToModel(OrderTransfer, json); UserTrack UserTrack = new UserTrack(); UserTrack = JsonToObject.ConvertJsonToModel(UserTrack, json); string Tag = "Transfer"; 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 == OrderTransfer.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 (baseUsers.UserName == OrderTransfer.ToUserName)//不能给自己转帐 { DataObj.OutError("6031"); return; } if (baseUsers.Amount < OrderTransfer.PayMoney)//余额不足 { DataObj.OutError("6001"); return; } //获取收款用户信息 Users ToUsers = Entity.Users.FirstOrDefault(n => n.UserName == OrderTransfer.ToUserName); if (ToUsers == null)//用户不存在 { DataObj.OutError("6004"); return; } if (ToUsers.State != 1)//用户被锁定 { DataObj.OutError("6003"); return; } //if (ToUsers.CardStae != 2)//未实名认证 //{ // DataObj.OutError("6006"); // return; //} //开始处理参数 if (OrderTransfer.PayMoney.IsNullOrEmpty())//转帐金额 { DataObj.OutError("1000"); return; } OrderTransfer.PayMoney = OrderTransfer.PayMoney.FormatMoney(); if (OrderTransfer.PayType.IsNullOrEmpty()) { OrderTransfer.PayType = 0; } if (OrderTransfer.X.IsNullOrEmpty() || OrderTransfer.Y.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } if (OrderTransfer.AId.IsNullOrEmpty()) { //支付方式,用于取出支付费率信息,计算各接口金额 DataObj.OutError("1000"); return; } //获取系统支付配置 PayConfig PayConfig = Entity.PayConfig.FirstOrDefault(n => n.Id == OrderTransfer.AId && n.State == 1); if (PayConfig == null) { DataObj.OutError("1000"); return; } //转帐目前只支持余额 if (PayConfig.DllName != "Cash") { DataObj.OutError("1000"); return; } //获取分支机构信息 SysAgent SysAgent = new SysAgent(); //获取系统配置 //SysSet SysSet = Entity.SysSet.FirstOrDefault(); OrderTransfer.UId = baseUsers.Id; OrderTransfer.RUId = ToUsers.Id; if (OrderTransfer.IsMe == 1)//付方出手续费 { //获取付方支付配置 UserPay UserPay = Entity.UserPay.FirstOrDefault(n => n.UId == baseUsers.Id && n.PId == OrderTransfer.AId); if (UserPay == null) { DataObj.OutError("1000"); return; } //获取付方机构信息 if (!baseUsers.Agent.IsNullOrEmpty()) { SysAgent = Entity.SysAgent.FirstOrNew(n => n.Id == baseUsers.Agent); } //手续费 OrderTransfer.Poundage = OrderTransfer.PayMoney * (decimal)UserPay.Cost; //手续费进位 OrderTransfer.Poundage = OrderTransfer.Poundage.Ceiling(); //总金额=转帐金额+手续费 OrderTransfer.Amoney = OrderTransfer.PayMoney + OrderTransfer.Poundage; //第三方支付通道率 OrderTransfer.SysRate = (double)PayConfig.Cost; //商户费率 OrderTransfer.UserRate = UserPay.Cost; //这里是利润计算========== //利润=总金额-转到帐-支付手续费 decimal GetAll = OrderTransfer.Amoney - OrderTransfer.PayMoney - OrderTransfer.Amoney * (decimal)OrderTransfer.SysRate; //利润舍位 GetAll = GetAll.Floor(); //总利润 OrderTransfer.AIdPayGet = (double)GetAll; //分支机构佣金设置为0,待分润计算后再写入 OrderTransfer.AgentPayGet = 0; } else //收方出手续费 //获取收方支付配置 { UserPay UserPay = Entity.UserPay.FirstOrDefault(n => n.UId == ToUsers.Id && n.PId == OrderTransfer.AId); if (UserPay == null) { DataObj.OutError("1000"); return; } //获取收方机构信息 if (!ToUsers.Agent.IsNullOrEmpty()) { SysAgent = Entity.SysAgent.FirstOrNew(n => n.Id == ToUsers.Agent); } //总金额=转帐金额+手续费 OrderTransfer.Amoney = OrderTransfer.PayMoney; //手续费 OrderTransfer.Poundage = OrderTransfer.Amoney * (decimal)UserPay.Cost; //手续费进位 OrderTransfer.Poundage = OrderTransfer.Poundage.Ceiling(); //到帐金额 OrderTransfer.PayMoney = OrderTransfer.Amoney - OrderTransfer.Poundage; //第三方支付通道率 OrderTransfer.SysRate = (double)PayConfig.Cost; //商户费率 OrderTransfer.UserRate = UserPay.Cost; //这里是利润计算========== //利润=总金额-转到帐-支付手续费 decimal GetAll = OrderTransfer.Amoney - OrderTransfer.PayMoney - OrderTransfer.Amoney * (decimal)OrderTransfer.SysRate; //利润舍位 GetAll = GetAll.Floor(); //总利润 OrderTransfer.AIdPayGet = (double)GetAll; //分支机构佣金设置为0,待分润计算后再写入 OrderTransfer.AgentPayGet = 0; } OrderTransfer.Agent = SysAgent.Id;//分支机构Id OrderTransfer.AId = baseUsers.AId; OrderTransfer.FId = 0; OrderTransfer.OrderState = 1; OrderTransfer.PayState = 0; OrderTransfer.AgentState = 0; OrderTransfer.AddTime = DateTime.Now; //写入前,判断交易金额限制 if (OrderTransfer.Amoney < syscontrol.SNum || OrderTransfer.Amoney > syscontrol.ENum) { DataObj.OutError("1006"); return; } //写入订单总表 Orders Orders = new Orders(); Orders.UId = OrderTransfer.UId; Orders.TName = "自 " + baseUsers.TrueName + " To " + ToUsers.TrueName; Orders.PayType = OrderTransfer.PayType; switch (Orders.PayType) { case 0: Orders.PayName = "转帐"; break; case 1: Orders.PayName = "当面付"; break; case 2: Orders.PayName = "收银台-钱包"; break; } Orders.RUId = ToUsers.Id; Orders.RName = ToUsers.TrueName; Orders.TType = 3; Orders.TState = 1; Orders.Amoney = OrderTransfer.Amoney; Orders.Poundage = OrderTransfer.Poundage; Orders.AddTime = DateTime.Now; Orders.PayState = 0; Orders.PayWay = PayConfig.Id; Orders.Agent = OrderTransfer.Agent; Orders.AgentState = 0; Orders.AId = OrderTransfer.AId; Orders.FId = 0; string OrderAddress = OrderTransfer.OrderAddress; if (OrderAddress.IsNullOrEmpty()) { OrderAddress = Utils.GetAddressByGPS(OrderTransfer.X, OrderTransfer.Y); } Orders.OrderAddress = OrderAddress; Orders.X = OrderTransfer.X; Orders.Y = OrderTransfer.Y; Orders.Remark = OrderTransfer.Remark; Entity.Orders.AddObject(Orders); Entity.SaveChanges(); Entity.Refresh(RefreshMode.StoreWins, Orders); OrderTransfer.OId = Orders.TNum; Entity.OrderTransfer.AddObject(OrderTransfer); 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; } 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 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 UploadOrder() { Thread thread = new Thread(() => { this.Running = true; Stopwatch watch = Stopwatch.StartNew(); this.Responsed?.Invoke(this, new ResponseEventArgs("已启动上传任务!")); TokenRequest request = new TokenRequest(AppConfig.UserName, AppConfig.Password); string result = string.Empty; GSTToken token = null; this.Responsed?.Invoke(this, new ResponseEventArgs("正在登录服务器......")); if (this.SendToCloud(request.ToUrlParameter(), this.url + "/connect/token", out result)) { token = JObject.Parse(result).ToObject <GSTToken>(); } else { this.Responsed?.Invoke(this, new ResponseEventArgs(result)); return; } int count = 0; int progress = 0; this.Responsed?.Invoke(this, new ResponseEventArgs("正在获取本地数据......")); using (GstDbContext context = new GstDbContext(this.connStr)) { int pageSize = AppConfig.ItemsOnce; int pageNo = 1; int total = context.KPIOrder.Count(); var list = context.KPIOrder.OrderBy(p => p.ID).Skip((pageNo - 1) * pageSize).Take(pageSize).ToList(); this.Responsed?.Invoke(this, new ResponseEventArgs("正在上传数据......")); while (list.Count > 0) { try { var jsonStr = JsonConvert.SerializeObject(list, Formatting.None); string data = DESEncrypt.Encrypt(jsonStr); var transfer = new OrderTransfer { Content = data }; var dataString = JObject.FromObject(transfer).ToString(); string response = string.Empty; this.SendToCloud(dataString, this.url + "/api/order/uploadorder", out response, token.Token_Type + " " + token.Access_Token); try { ApiResult apiResult = JObject.Parse(response).ToObject <ApiResult>(); if (apiResult.Code == 0) { count += list.Count; } else { this.Responsed?.Invoke(this, new ResponseEventArgs(apiResult.Message)); } } catch (Exception ex) { this.Responsed?.Invoke(this, new ResponseEventArgs(response)); } progress += list.Count; list = context.KPIOrder.OrderBy(p => p.ID).Skip((++pageNo - 1) * pageSize).Take(pageSize).ToList(); this.Processed?.Invoke(this, new ProgressEventArgs() { Progress = progress * 1.0 / total * 100 }); } catch (Exception ex) { this.Responsed?.Invoke(this, new ResponseEventArgs(ex.Message)); } } } watch.Stop(); this.Successed?.Invoke(this, new SuccEventArgs(watch.Elapsed, count)); this.Running = false; }); thread.IsBackground = true; thread.Start(); }
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("[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 ActionResult GoPay(int shopid = 0, decimal Amount = 0, byte payway = 0) { if (shopid.IsNullOrEmpty()) { ViewBag.ErrorMsg = "商户信息有误,请核实!"; return(View("Error")); } if (Amount.IsNullOrEmpty()) { ViewBag.ErrorMsg = "付款金额有误,请核实!"; return(View("Error")); } Users Users = Entity.Users.FirstOrNew(n => n.Id == shopid && n.State == 1 && n.CardStae == 2); if (Users.Id.IsNullOrEmpty()) { ViewBag.ErrorMsg = "商户信息有误,请核实!"; return(View("Error")); } if (Amount <= 0) { ViewBag.ErrorMsg = "付款金额有误![00]"; return(View("Error")); } string Tag = string.Empty; if (IsWeiXinBrowser) { Tag = "WeiXin"; } else if (IsAlipayBrowser) { Tag = "Alipay"; } else { Tag = "RecMoneyMulti"; } SysControl SysControl = Entity.SysControl.FirstOrNew(n => n.Tag == Tag && n.Id == payway); SysControl syscontrol = SysControl.ChkState(); if (syscontrol.State != 1) { ViewBag.ErrorMsg = "支付接口维护中,请使用其它支付通道!"; return(View("Error")); } int SNum = syscontrol.SNum; int ENum = syscontrol.ENum; if (SysControl.Tag == "RecMoneyMulti") { if (ENum > BasicSet.CtrlMoney1) { ENum = (int)BasicSet.CtrlMoney1; } } if (Amount < SNum || Amount > ENum) { ViewBag.ErrorMsg = "收款金额范围:" + SNum + "~" + ENum + "元!"; return(View("Error")); } var PayConfig = Entity.PayConfig.FirstOrDefault(o => o.Id == SysControl.PayWay); if (PayConfig == null) { ViewBag.ErrorMsg = "支付配置不存在"; return(View("Error")); } //业务开始 switch (PayConfig.DllName) { case "Transfer": //钱包接口 OrderTransfer OrderTransfer = new OrderTransfer(); OrderTransfer.Amoney = Amount; OrderTransfer.Remark = Users.UserName; ViewBag.OrderTransfer = OrderTransfer; SysAgent SysAgent = Entity.SysAgent.FirstOrNew(n => n.Id == Users.Agent && n.State == 1 && n.IsTeiPai == 1); ViewBag.SysAgent = SysAgent; return(View("Transfer")); case "HFAliPay": //不管直联还是结算中心,由API处理 case "Alipay": return(AliPay(Users, Amount, PayConfig, SysControl)); case "HFWeiXin": //不管直联还是结算中心,由API处理 case "WeiXin": return(WeiXinPay(Users, Amount, PayConfig, SysControl)); case "Unionpay": //走银联接口 case "HFPay": //走银联接口 return(BankPay(Users, Amount, PayConfig, SysControl)); default: 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 IActionResult post([FromBody] OrderTransfer orderTransfer) { _orderService.Transfer(orderTransfer); return(Ok(orderTransfer)); }