From 597399726303f4f6f41b0a55d8dcaa153f49b97a Mon Sep 17 00:00:00 2001 From: yzh <snbbt@21cn.com> Date: 星期四, 19 五月 2022 14:57:33 +0800 Subject: [PATCH] 账号信息增加是否自动返还 系统账号信息增加:用户类型 客户信息增加:归属客户经理、归属业务员、归属客服人员、归属财务等 客户账号查询优化 账号查询充值优化 --- web/web/GwOrder.ashx | 155 ++++++++++++++++++++++++++++++++++----------------- 1 files changed, 103 insertions(+), 52 deletions(-) diff --git a/web/web/GwOrder.ashx b/web/web/GwOrder.ashx index 30c4bfd..99c1784 100644 --- a/web/web/GwOrder.ashx +++ b/web/web/GwOrder.ashx @@ -9,6 +9,7 @@ { private GwOrderDao _Dao = new GwOrderDao(); private GwSpDao _GwSpDao = new GwSpDao(); + private GwClientDao _GwClientDao = new GwClientDao(); private GwOpGroupDao _GwOpGroupDao = new GwOpGroupDao(); private GwProductDao _GwProductDao = new GwProductDao(); private SysXhDao _SysXhDao = new SysXhDao(); @@ -87,7 +88,8 @@ str1 = str1 + "<td>" + bean.GivingNum + "</td>"; 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.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>"; @@ -101,7 +103,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 { @@ -144,7 +146,8 @@ str1 = str1 + "<td>" + bean.GivingNum + "</td>"; 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.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>"; @@ -162,7 +165,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 { @@ -190,6 +193,8 @@ string clientId = context.GetString("clientId"); string clientName = context.GetString("clientName"); int flag = context.GetInt("flag"); + //string startDate = context.GetString("startDate"); + //string endDate = context.GetString("endDate"); DateTime startDate = context.GetDateTime("startDate"); DateTime endDate = context.GetDateTime("endDate"); @@ -197,7 +202,8 @@ int pageSize = context.GetInt("pageSize", 50); int pageIndex = context.GetInt("pageIndex", 1); - List<GwOrder> list = _Dao.LoadInfoList(spId, clientId, clientName, flag, startDate, endDate, pageSize, pageIndex, out recordCount); + //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); string str1 = ""; if (list != null && list.Count > 0) @@ -217,7 +223,8 @@ str1 = str1 + "<td>" + bean.GivingNum + "</td>"; 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.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>"; @@ -235,7 +242,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 { @@ -286,8 +293,12 @@ string orderId = context.GetString("orderId"); int basicNum = context.GetInt("basicNum"); 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)), 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"); @@ -307,7 +318,7 @@ if (gwOrder.Status !=0 && gwOrder.Status !=1) throw new ArgumentException("璇ヨ鍗曞凡澶勭悊,鎿嶄綔澶辫触锛�"); - + clientId = gwOrder.ClientId; //鑾峰彇璁㈠崟瀹℃牳娴佺▼ string flowGroup = null; //娴佺▼缁勫悎 @@ -417,35 +428,51 @@ } else if(status==1) { - int beforeBasicNum = 0; - int beforeGivingNum = 0; - int balance = 0; - if(string.IsNullOrEmpty(nextFlowCode)) + int beforeBasicNum = 0; + int beforeGivingNum = 0; + int balance = 0; + int topUpAmountTotal = 0; + if (string.IsNullOrEmpty(nextFlowCode)) { - orderStatus = 2; + orderStatus = 2; //鑾峰彇璐﹀彿淇℃伅 GwSp gwSp = _GwSpDao.Get(spId); beforeBasicNum = gwSp.BasicNum; beforeGivingNum = gwSp.GivingNum; - balance = Convert.ToInt32(gwSp.Balance); + //balance = Convert.ToInt32(gwSp.Balance); - //涓�1-棰勪粯璐� - if (gwSp.ChargeType.Equals("1") && gwSp.Balance < num * basicNum ) + //鑾峰彇瀹㈡埛淇℃伅 + GwClient gwClient = _GwClientDao.Get(gwSp.ClientID); + balance = int.Parse(gwClient.Balance.ToString() ); + topUpAmountTotal = int.Parse(gwClient.Top_up_Amount_Total.ToString() ); + + //涓�1-棰勪粯璐� + //if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) + if (gwClient.ChargeType==1 && (balance + payAmount) < num * basicNum) { - throw new ArgumentException("璐﹀彿浣欓涓嶈冻锛岃鑱旂郴绠$悊鍛橈紒"); + throw new ArgumentException("瀹㈡埛浣欓鍙婂厖鍊奸噾棰濅笉瓒宠喘涔帮紝璇疯皟鏁村悗鎻愪氦锛�"); } //gwSp.Balance = balance - num * basicNum; //gwSp.BasicNum = beforeBasicNum + basicNum; //gwSp.GivingNum = beforeGivingNum + givingNum; + //鏇存柊璐﹀彿鍏呭�兼暟鎹� + _GwSpDao.UpdateBalanceByOrder( payAmount, basicNum , givingNum , spId ); - _GwSpDao.UpdateBalanceByOrder(balance - num * basicNum - , beforeBasicNum + basicNum - , beforeGivingNum + givingNum - , spId - ); + + //鏈夊厖鍊奸噾棰濇椂锛屾洿鏂板鎴风疮璁″厖鍊奸噾棰濓紙鍘橈級 + if (payAmount > 0 || basicNum > 0 ) { + //GwClient gwClient = new 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 { @@ -462,8 +489,8 @@ //newGwOrder.OrderAmountTotal = basicNum * num ; //newGwOrder.BeforeBalanceNum = beforeGivingNum + beforeGivingNum; //newGwOrder.Status = orderStatus; - //鏇存柊璁㈠崟 - _Dao.UpdateBalanceAndStatus(basicNum, givingNum, basicNum + givingNum, basicNum * num, beforeGivingNum + beforeGivingNum,orderStatus, orderId ); + //鏇存柊璁㈠崟 + _Dao.UpdateBalanceAndStatus(basicNum, givingNum, basicNum + givingNum, basicNum * num, payAmount, beforeGivingNum + beforeGivingNum, orderStatus, orderId ); //Dao.Update(newGwOrder); @@ -496,6 +523,7 @@ int orderNumTotal = context.GetInt("orderNumTotal", 0); int orderAmountTotal = context.GetInt("orderAmountTotal", 0); + int payAmount = 0; int beforeBalanceNum = context.GetInt("beforeBalanceNum", 0); //瀹㈡湇浜哄憳鎻愪氦璁㈠崟鏃剁殑鐘舵�佷负1-瀹℃牳涓�� int status = 1; //0-寰呭鏍革紙宸叉彁浜わ級锛�1-瀹℃牳涓紱2-瀹℃牳閫氳繃锛�3-瀹℃牳涓嶉�氳繃锛�4-鍙栨秷锛涚敵璇疯鍗曞湪鏈鏍告儏鍐典笅鍙互鍙栨秷銆� @@ -503,7 +531,9 @@ DateTime createTime = DateTime.Now; string creator = context.OperatorID; - int num = Math.Max((int) (context.GetDecimal("price", 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; + int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 0); price = num; //鏍¢獙 @@ -523,9 +553,33 @@ throw new ArgumentException("璐﹀彿涓嶈兘涓虹┖锛�"); } - if (basicNum<=0 && givingNum <= 0) + if (basicNum<=0 && givingNum <= 0 && payAmount <=0) { - throw new ArgumentException("鍩烘湰鏉℃暟鎴栬禒閫佹潯鏁板繀椤诲ぇ浜庨浂锛�"); + throw new ArgumentException("鍏呭�奸噾棰濇垨鍩烘湰鏉℃暟鎴栬禒閫佹潯鏁板繀椤诲ぇ浜庨浂锛�"); + } + + //鑾峰彇璐﹀彿淇℃伅 + GwSp gwSp = _GwSpDao.Get(spId); + int balance = 0; + if (gwSp == null) + { + throw new ArgumentException("璐﹀彿涓嶅瓨鍦紒"); + } + else if (gwSp.Status==0) + { + throw new ArgumentException("璐﹀彿宸茬鐢紒"); + } + + + //鑾峰彇瀹㈡埛淇℃伅 + GwClient gwClient = _GwClientDao.Get(gwSp.ClientID); + balance = int.Parse(gwClient.Balance.ToString() ); + + //涓�1-棰勪粯璐� + //if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) + if (gwClient.ChargeType==1 && (balance + payAmount) < num * basicNum) + { + throw new ArgumentException("瀹㈡埛浣欓鍙婂厖鍊奸噾棰濅笉瓒宠喘涔帮紝璇疯皟鏁村悗鎻愪氦锛�"); } //鑾峰彇璁㈠崟瀹℃牳娴佺▼ @@ -588,18 +642,6 @@ throw new ArgumentException("鐢ㄦ埛娌℃湁鍏呭�兼潈闄愶紝璇疯仈绯荤鐞嗗憳锛�"); } - - //鑾峰彇璁㈠崟淇℃伅 - GwSp gwSp = _GwSpDao.Get(spId); - if (gwSp == null) - { - throw new ArgumentException("璐﹀彿涓嶅瓨鍦紒"); - } - else if (gwSp.Status==0) - { - throw new ArgumentException("璐﹀彿宸茬鐢紒"); - } - productId = gwSp.ProductId; price = gwSp.Price; @@ -620,6 +662,7 @@ Price = price, //鍗曚环鎹㈢畻 OrderNumTotal = orderNumTotal, OrderAmountTotal = orderAmountTotal, + PayAmount = payAmount, BeforeBalanceNum = beforeBalanceNum, Status = status, Remark = remark, @@ -628,19 +671,22 @@ }); - - string auditId = _SysXhDao.getXh("GW_ORDER_AUDIT"); //鑾峰彇鐢熸垚璁㈠崟瀹℃牳ID - this._GwOrderAuditDao.Add(new GwOrderAudit() + //娴佺▼缁勫悎涓虹┖鏃� + if (!string.IsNullOrEmpty(flowGroup)) { - AuditId = auditId, - OrderId = orderId, - AuditSort = sort, - AuditStatus = status, - Auditor = creator, - //AuditReason = null, - AuditTime = createTime + string auditId = _SysXhDao.getXh("GW_ORDER_AUDIT"); //鑾峰彇鐢熸垚璁㈠崟瀹℃牳ID + this._GwOrderAuditDao.Add(new GwOrderAudit() + { + AuditId = auditId, + OrderId = orderId, + AuditSort = sort, + AuditStatus = status, + Auditor = creator, + //AuditReason = null, + AuditTime = createTime - }); + }); + } return new JsonPageResult(true, "鐢熸垚璁㈠崟淇℃伅鎴愬姛锛�"); @@ -660,13 +706,17 @@ int orderNumTotal = context.GetInt("orderNumTotal", 0); int orderAmountTotal = context.GetInt("orderAmountTotal", 0); + int payAmount = 0; int beforeBalanceNum = context.GetInt("beforeBalanceNum", 0); int status = 0; string remark = context.GetString("remark"); DateTime createTime = DateTime.Now; string creator = context.OperatorID; - int num = Math.Max((int) (context.GetDecimal("price", 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; + + int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 0); price = num; //鏍¢獙 @@ -703,6 +753,7 @@ Price = price, //鍗曚环鎹㈢畻 OrderNumTotal = orderNumTotal, OrderAmountTotal = orderAmountTotal, + PayAmount = payAmount, BeforeBalanceNum = beforeBalanceNum, Status = status, Remark = remark, -- Gitblit v1.9.1