From 3b18a48485f7207438d9d0eb3038d979e069431d Mon Sep 17 00:00:00 2001 From: yzh <snbbt@21cn.com> Date: 星期四, 26 五月 2022 17:58:18 +0800 Subject: [PATCH] 优化产品及产品分类,订单,对称加密,IP转地区名称 --- web/web/GwOrder.ashx | 117 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 66 insertions(+), 51 deletions(-) diff --git a/web/web/GwOrder.ashx b/web/web/GwOrder.ashx index 471e79e..dbe8cc6 100644 --- a/web/web/GwOrder.ashx +++ b/web/web/GwOrder.ashx @@ -23,10 +23,18 @@ private List<GwOpGroup> _GroupList; private List<GwProduct> _ProductList; //浜у搧鍙婁骇鍝佸垎绫� //private List<GwProduct> _ProductClassList; //浜у搧鍒嗙被 + + private int _userId = -1; + private int _userType = -1; + private string _account = ""; public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context) { string @string = context.GetString("action"); + _userId = context.SessionObject.UserID; + _userType = context.SessionObject.UserType; + _account = context.SessionObject.Account; + switch (@string) { case "delete": @@ -59,7 +67,7 @@ //Console.WriteLine("List.............[" + context.GetInt("name") + "][" + context.GetInt("classes") + "]"); string spId = context.GetString("spId"); string clientId = context.GetString("clientId"); - string clientName = context.GetString("clientName"); + string compay = context.GetString("compay"); int flag = context.GetInt("flag"); DateTime startDate = context.GetDateTime("startDate"); DateTime endDate = context.GetDateTime("endDate"); @@ -67,8 +75,10 @@ int recordCount = 0; int pageSize = context.GetInt("pageSize", 50); int pageIndex = context.GetInt("pageIndex", 1); + + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC"); - List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate, pageSize, pageIndex, out recordCount); + List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, compay, flag, startDate, endDate, pageSize, pageIndex, permissionsSQL, out recordCount); string str1 = ""; if (list != null && list.Count > 0) @@ -86,10 +96,10 @@ //str1 = str1 + "<td>" + bean.ComboId + "</td>"; str1 = str1 + "<td>" + bean.BasicNum + "</td>"; str1 = str1 + "<td>" + bean.GivingNum + "</td>"; - str1 = str1 + string.Format("<td>{0}鍏�/鏉�</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); str1 = str1 + "<td>" + bean.OrderNumTotal + "</td>"; - str1 = str1 + string.Format("<td>{0}鍏�</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000))); - str1 = str1 + string.Format("<td>{0}鍏�</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000))); str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>"; str1 = str1 + "<td>" + bean.Creator + "</td>"; str1 = str1 + "<td>" + bean.CreateTime + "</td>"; @@ -103,7 +113,7 @@ } } else - str1 += "<tr><td colspan=\"14\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; + str1 += "<tr><td colspan=\"15\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; return new JsonPageResult(true, new { @@ -125,8 +135,10 @@ int recordCount = 0; int pageSize = context.GetInt("pageSize", 50); int pageIndex = context.GetInt("pageIndex", 1); + + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC"); - List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate, pageSize, pageIndex, out recordCount); + List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate, pageSize, pageIndex, permissionsSQL, out recordCount); string str1 = ""; if (list != null && list.Count > 0) @@ -137,17 +149,18 @@ { ++num; - str1 += "<tr><td>" + bean.OrderId + "</td>"; - str1 = str1 + "<td>" + bean.SpId + "</td>"; - str1 = str1 + "<td>" + bean.ClientId + "-" + bean.ClientName + "</td>"; + //str1 += "<tr><td>" + bean.OrderId + "</td>"; + str1 = str1 + "<tr><td>" + bean.SpId + "</td>"; + str1 = str1 + "<td>" + bean.ClientId + "</td>"; + str1 = str1 + "<td>" + bean.Company + "</td>"; str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>"; //str1 = str1 + "<td>" + bean.ComboId + "</td>"; str1 = str1 + "<td>" + bean.BasicNum + "</td>"; str1 = str1 + "<td>" + bean.GivingNum + "</td>"; - str1 = str1 + string.Format("<td>{0}鍏�/鏉�</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); str1 = str1 + "<td>" + bean.OrderNumTotal + "</td>"; - str1 = str1 + string.Format("<td>{0}鍏�</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000))); - str1 = str1 + string.Format("<td>{0}鍏�</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000))); str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>"; str1 = str1 + "<td>" + bean.Creator + "</td>"; str1 = str1 + "<td>" + bean.CreateTime + "</td>"; @@ -165,7 +178,7 @@ } } else - str1 += "<tr><td colspan=\"14\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; + str1 += "<tr><td colspan=\"15\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; return new JsonPageResult(true, new { @@ -201,9 +214,11 @@ int recordCount = 0; int pageSize = context.GetInt("pageSize", 50); int pageIndex = context.GetInt("pageIndex", 1); + + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, "GWC"); //List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate).AddDays(1.0), pageSize, pageIndex, out recordCount); - List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate.AddDays(1.0), pageSize, pageIndex, out recordCount); + List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate.AddDays(1.0), pageSize, pageIndex, permissionsSQL, out recordCount); string str1 = ""; if (list != null && list.Count > 0) @@ -214,24 +229,25 @@ { ++num; - str1 += "<tr><td>" + bean.OrderId + "</td>"; + //str1 += "<tr><td>" + bean.OrderId + "</td>"; str1 = str1 + "<td>" + bean.SpId + "</td>"; - str1 = str1 + "<td>" + bean.ClientId + "-" + bean.ClientName + "</td>"; + str1 = str1 + "<td>" + bean.ClientId + "</td>"; + str1 = str1 + "<td>" + bean.Company + "</td>"; str1 = str1 + "<td>" + ProductToName(bean.ProductId) + "</td>"; //str1 = str1 + "<td>" + bean.ComboId + "</td>"; str1 = str1 + "<td>" + bean.BasicNum + "</td>"; str1 = str1 + "<td>" + bean.GivingNum + "</td>"; - str1 = str1 + string.Format("<td>{0}鍏�/鏉�</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000))); str1 = str1 + "<td>" + bean.OrderNumTotal + "</td>"; - str1 = str1 + string.Format("<td>{0}鍏�</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000))); - str1 = str1 + string.Format("<td>{0}鍏�</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.OrderAmountTotal) / new Decimal(1000))); + str1 = str1 + string.Format("<td>{0}</td>", (object)(Convert.ToDecimal(bean.PayAmount) / new Decimal(1000))); str1 = str1 + "<td>" + bean.BeforeBalanceNum + "</td>"; str1 = str1 + "<td>" + bean.Creator + "</td>"; str1 = str1 + "<td>" + bean.CreateTime + "</td>"; str1 = str1 + "<td>" + StatusToName(bean.Status) + "</td>"; //str1 = str1 + "<td>" + bean.Remark + "</td>"; - str1 += "<td class=\"text-right\">"; + str1 += "<td class=\"text-center\">"; str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-detail btn btn-success btn-xs\"><i class=\"fa fa-search\"></i> 鏌ョ湅</a> ", (object) bean.OrderId); //str1 += string.Format("<a href=\"javascript:;\" data-orderid=\"{0}\" class=\"action-modal-audit btn btn-success btn-xs\"><i class=\"fa fa-search\"></i> 瀹℃牳</a> ", (object) bean.OrderId); //if(bean.Status == 0) { @@ -242,7 +258,7 @@ } } else - str1 += "<tr><td colspan=\"14\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; + str1 += "<tr><td colspan=\"15\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; return new JsonPageResult(true, new { @@ -295,10 +311,10 @@ int givingNum = context.GetInt("givingNum"); string clientId = ""; int payAmount = 0; - int tmpPayAmount = Math.Max((int) (context.GetDecimal("payAmount", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); + int tmpPayAmount = Math.Max((int) (context.GetDecimal("payAmount", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 0); payAmount = tmpPayAmount; //double price = context.GetDecimal(price); - int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); + int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 0); string remark = context.GetString("remark"); int status = context.GetInt("status"); //0-瀹℃牳涓嶉�氳繃锛�1-瀹℃牳閫氳繃 string auditReason = context.GetString("auditReason"); @@ -434,7 +450,7 @@ int topUpAmountTotal = 0; if (string.IsNullOrEmpty(nextFlowCode)) { - orderStatus = 2; + orderStatus = 2; //鑾峰彇璐﹀彿淇℃伅 GwSp gwSp = _GwSpDao.Get(spId); @@ -449,7 +465,8 @@ topUpAmountTotal = int.Parse(gwClient.Top_up_Amount_Total.ToString() ); //涓�1-棰勪粯璐� - if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) + //if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) + if (gwClient.ChargeType==1 && (balance + payAmount) < num * basicNum) { throw new ArgumentException("瀹㈡埛浣欓鍙婂厖鍊奸噾棰濅笉瓒宠喘涔帮紝璇疯皟鏁村悗鎻愪氦锛�"); } @@ -457,23 +474,20 @@ //gwSp.Balance = balance - num * basicNum; //gwSp.BasicNum = beforeBasicNum + basicNum; //gwSp.GivingNum = beforeGivingNum + givingNum; - - _GwSpDao.UpdateBalanceByOrder(balance - num * basicNum - , beforeBasicNum + basicNum - , beforeGivingNum + givingNum - , spId - ); + //鏇存柊璐﹀彿鍏呭�兼暟鎹� + _GwSpDao.UpdateBalanceByOrder( payAmount, basicNum , givingNum , spId ); //鏈夊厖鍊奸噾棰濇椂锛屾洿鏂板鎴风疮璁″厖鍊奸噾棰濓紙鍘橈級 - if (payAmount > 0) { + if (payAmount > 0 || basicNum > 0 ) { //GwClient gwClient = new GwClient(); - gwClient = new GwClient(); - gwClient.Top_up_Amount_Total = topUpAmountTotal + payAmount; //绱閲戦:鍗曚綅锛堝帢锛� - gwClient.Balance = ((balance + payAmount) - num * basicNum) ; //璐︽埛浣欓:鍗曚綅锛堝帢锛� - gwClient.ClientID = clientId; - - _GwClientDao.UpdateClientAmount(gwClient); + //gwClient = new GwClient(); + //gwClient.Balance = ((balance + payAmount) - num * basicNum) ; //鍏呭�间綑棰�:鍗曚綅锛堝帢锛� + //gwClient.Top_up_Amount_Total = topUpAmountTotal + payAmount; //鍏呭�奸噾棰�:鍗曚綅锛堝帢锛� + //gwClient.ClientID = clientId; + + //鏇存柊瀹㈡埛鍏呭�兼暟鎹� + _GwClientDao.UpdateClientAmount(payAmount-( num * basicNum), payAmount, clientId ); } } else @@ -578,7 +592,8 @@ balance = int.Parse(gwClient.Balance.ToString() ); //涓�1-棰勪粯璐� - if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) + //if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) + if (gwClient.ChargeType==1 && (balance + payAmount) < num * basicNum) { throw new ArgumentException("瀹㈡埛浣欓鍙婂厖鍊奸噾棰濅笉瓒宠喘涔帮紝璇疯皟鏁村悗鎻愪氦锛�"); } @@ -817,9 +832,9 @@ if (classes == -1) return string.Empty; else if(classes == 0) - return "0-浜у搧鍒嗙被"; + return "浜у搧鍒嗙被"; else if(classes == 1) - return "1-浜у搧"; + return "浜у搧"; return string.Empty; } @@ -830,9 +845,9 @@ if (isDefault == -1) return string.Empty; else if(isDefault == 0) - return "0-涓�у寲"; + return "涓�у寲"; else if(isDefault == 1) - return "1-绯荤粺榛樿"; + return "绯荤粺榛樿"; return string.Empty; } @@ -843,9 +858,9 @@ if (isEnable == -1) return string.Empty; else if(isEnable == 0) - return "0-鍋滅敤"; + return "鍋滅敤"; else if(isEnable == 1) - return "1-鍚敤"; + return "鍚敤"; return string.Empty; } @@ -867,15 +882,15 @@ if (status == -1) return string.Empty; else if(status == 0) - return "0-寰呭鏍革紙宸叉彁浜わ級"; + return "寰呭鏍革紙宸叉彁浜わ級"; else if(status == 1) - return "1-瀹℃牳涓�"; + return "瀹℃牳涓�"; else if(status == 2) - return "2-瀹℃牳閫氳繃"; + return "瀹℃牳閫氳繃"; else if(status == 3) - return "3-瀹℃牳涓嶉�氳繃"; + return "瀹℃牳涓嶉�氳繃"; else if(status == 4) - return "4-鍙栨秷"; + return "鍙栨秷"; return string.Empty; } -- Gitblit v1.9.1