From 374ce4ffd0c459bb4067e8d5765f972668aff9b1 Mon Sep 17 00:00:00 2001 From: wzp <2040239371@qq.com> Date: 星期四, 02 三月 2023 14:56:23 +0800 Subject: [PATCH] 变更oracle访问组件 --- web/web/GwSp.ashx | 162 ++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 110 insertions(+), 52 deletions(-) diff --git a/web/web/GwSp.ashx b/web/web/GwSp.ashx index 35395b4..78adb08 100644 --- a/web/web/GwSp.ashx +++ b/web/web/GwSp.ashx @@ -57,10 +57,10 @@ { if (this._ClientList == null) { - using (GwClientDao gwClientDao = new GwClientDao()) { + using (GwClientDao gwClientDao = new GwClientDao()) { string permissionsSQL = gwClientDao.GetClientPermissions(_userId, _userType, null); this._ClientList = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); - } + } } return this._ClientList; } @@ -101,9 +101,9 @@ using (GwProductDao gwProductDao = new GwProductDao()) { GwProduct gwProduct = new GwProduct(); - gwProduct.Classes = -1; - gwProduct.IsDefault = -1; - gwProduct.IsEnable = -1; + gwProduct.Classes = -1; + gwProduct.IsDefault = -1; + gwProduct.IsEnable = -1; this._ProductList = gwProductDao.getAllList(gwProduct); } } @@ -307,28 +307,28 @@ string string1 = context.GetString("apID"); string clientId = context.GetString("clientID"); string string2 = context.GetString("spID"); - string string3 = context.GetString("opID"); + string opId = context.GetString("opID"); int int1 = context.GetInt("routerType"); - string string4 = context.GetString("clientName"); + string company = context.GetString("company"); int int2 = context.GetInt("chargeType"); int recordCount = 0; int int3 = context.GetInt("pageSize", 20); int int4 = context.GetInt("pageIndex", 1); int int5 = context.GetInt("resendStatus", 1); string productId = context.GetString("productId")==null? "": context.GetString("productId"); - if (!string.IsNullOrEmpty(string3) && int1 <= 0) - throw new ArgumentException("璇烽�夋嫨閫氶亾缁勮矾鐢辨ā寮�"); + if (!string.IsNullOrEmpty(opId) && int1 <= 0) + { throw new ArgumentException("璇烽�夋嫨閫氶亾缁勮矾鐢辨ā寮�"); } GwSpDao gwSpDao = new GwSpDao(); string apId = "0"; if (this.IsInt(string1)) apId = string1; //if (string.IsNullOrEmpty(clientId) && !string.IsNullOrEmpty(string4)) // clientId = new GwClientDao().GetClientName(string4).ClientID; - + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); //鍔犺浇璐﹀彿鍒楄〃淇℃伅 - List<GwSp> list = gwSpDao.LoadInfoList(string2, apId, clientId, string4, int1, string3, int2, int4, int3, int5.ToString(), productId, permissionsSQL, out recordCount); + List<GwSp> list = gwSpDao.LoadInfoList(string2, apId, clientId, company, int1, opId, int2, int4, int3, int5.ToString(), productId, permissionsSQL, out recordCount); string str1 = ""; if (list != null && list.Count > 0) { @@ -343,14 +343,14 @@ if (gwSp.RouterType == 1) { str1 += "<td rowspan=\"1\"><span class='label label-primary'>閫氶亾</span>"; - str1 += string.Format("<div>绉诲姩锛歿0}</div><div>鐢典俊锛歿1}</div><div>鑱旈�氾細{2}</div>", (object)this.GetOpName(gwSp.CMOPID), (object)this.GetOpName(gwSp.CTOPID), (object)this.GetOpName(gwSp.UNOPID)); + str1 += string.Format("<div style='margin-top:10px;'>绉诲姩锛歿0}</div><div>鐢典俊锛歿1}</div><div>鑱旈�氾細{2}</div>", (object)this.GetOpName(gwSp.CMOPID), (object)this.GetOpName(gwSp.CTOPID), (object)this.GetOpName(gwSp.UNOPID)); } else if (gwSp.RouterType == 3) { str1 += "<td rowspan=\"1\"><span class='label label-success'>閫氶亾缁�</span>"; - str1 += string.Format("<div>绉诲姩锛歿0}</div><div>鐢典俊锛歿1}</div><div>鑱旈�氾細{2}</div>", (object)this.GetGroupName(gwSp.CMGroupID), (object)this.GetGroupName(gwSp.CTGroupID), (object)this.GetGroupName(gwSp.CUGroupID)); + str1 += string.Format("<div style='margin-top:10px;'>绉诲姩锛歿0}</div><div>鐢典俊锛歿1}</div><div>鑱旈�氾細{2}</div>", (object)this.GetGroupName(gwSp.CMGroupID), (object)this.GetGroupName(gwSp.CTGroupID), (object)this.GetGroupName(gwSp.CUGroupID)); } - + /** if (gwSp.RESEND_STATUS == 1) { str1 += "<td rowspan=\"1\"><span class='label label-success'>鍚敤澶辫触琛ュ彂</span>"; @@ -360,7 +360,7 @@ else { str1 += "<td rowspan=\"1\"><span class='label label-danger'>鍋滅敤澶辫触琛ュ彂</span>"; - } + }**/ string str2 = gwSp.ChargerTypeText ; @@ -373,31 +373,33 @@ str1 = str1 + (object)"<td>" + (object)(gwSp.BasicNum + (long)gwSp.GivingNum) + "鏉� / " + (object)(gwSp.BasicNum) + "鏉� / " + (object)(gwSp.GivingNum) + "鏉�"; //add: yangzh by 2022-03-14 end if (gwSp.BalanceThreshold > 0 && !string.IsNullOrEmpty(gwSp.AlarmMobile)) - str1 = str1 + (object)"<div class=\"text-danger\">" + (object)(gwSp.BalanceThreshold / 1000) + "鍏�(" + gwSp.AlarmMobile + ")</div>"; + str1 = str1 + "<div class=\"text-danger\">" + gwSp.BalanceThreshold + "鏉�(" + gwSp.AlarmMobile + ")</div>"; str1 += "</td>"; - str1 = str1 + "<td>" + this.GetDiverterName(gwSp.DiverterID); - str1 = str1 + "<div class=\"text-muted\">" + this.GetStratedyName(gwSp.StrategyID) + "</div>"; - str1 = str1 + "<div class=\"text-muted\"><font color=\"red\">" + this.GwSPAuditingName(gwSp.AuditingMode) + "</font></div>"; - str1 = str1 + "<div class=\"text-muted\">鍏ㄥ眬榛戝悕鍗�" + gwSp.BlackModeText + "</div>"; - str1 += "</td>"; - str1 = str1 + "<td>" + gwSp.AccessCode; - str1 = str1 + "<div class=\"text-muted\">" + (gwSp.ExtnoExtensionMode == 1 ? "绂佹瀹㈡埛鎵╁睍" : "鍏佽瀹㈡埛鎵╁睍") + "</div>"; - str1 = str1 + "<div>" + (gwSp.AccessCodeMode == 1 ? "閫氶亾鐩磋繛妯″紡" : "铏氭嫙鎺ュ叆妯″紡") + "</div></td>"; - str1 = str1 + "<td>" + this.FormatIpHtml(gwSp.ClientIp) + "</td>"; + /** + str1 = str1 + "<td>" + this.GetDiverterName(gwSp.DiverterID); + str1 = str1 + "<div class=\"text-muted\">" + this.GetStratedyName(gwSp.StrategyID) + "</div>"; + str1 = str1 + "<div class=\"text-muted\"><font color=\"red\">" + this.GwSPAuditingName(gwSp.AuditingMode) + "</font></div>"; + str1 = str1 + "<div class=\"text-muted\">鍏ㄥ眬榛戝悕鍗�" + gwSp.BlackModeText + "</div>"; + str1 += "</td>"; + str1 = str1 + "<td>" + gwSp.AccessCode; + str1 = str1 + "<div class=\"text-muted\">" + (gwSp.ExtnoExtensionMode == 1 ? "绂佹瀹㈡埛鎵╁睍" : "鍏佽瀹㈡埛鎵╁睍") + "</div>"; + str1 = str1 + "<div>" + (gwSp.AccessCodeMode == 1 ? "閫氶亾鐩磋繛妯″紡" : "铏氭嫙鎺ュ叆妯″紡") + "</div></td>"; + **/ + //str1 = str1 + "<td>" + this.FormatIpHtml(gwSp.ClientIp) + "</td>";//鍘绘帀IP // str1 = str1 + "<td>" + this.GetStatusText(gwSp.Status); str1 = str1 + "<td>" + this.GetStatusText(gwSp.Status, gwSp.SpID); str1 += "</td>"; str1 += "<td>" + gwSp.CreateTime + "</td>"; - str1 += "<td rowspan=\"1\" class=\"text-right\">"; + str1 += "<td rowspan=\"1\" class=\"text-center\" >"; if (context.HasRight("3023")) - str1 += string.Format(" <a class=\"btn-block btn btn-primary btn-xs action-modal-edit\" data-id=\"{0}\"><i class=\"fa fa-edit\"></i> 缂栬緫</a>", (object)gwSp.SpID); + str1 += string.Format(" <a style='margin-top:5px;' class=\"btn btn-primary btn-xs action-modal-edit\" data-id=\"{0}\"><i class=\"fa fa-edit\"></i> 缂栬緫</a>", (object)gwSp.SpID); //str1 += string.Format(" <a class=\"btn-block btn btn-success btn-xs action-create-summary\" data-id=\"{0}\">璐﹀彿鎽樿</a>", (object)gwSp.SpID); - str1 = gwSp.Status != 0 ? str1 + string.Format("<a href=\"javascript:;\" data-spid=\"{0}\" data-status=\"0\" class=\"action-updateStatus btn btn-primary btn-xs\"><i class=\"fa fa-toggle-off\"></i> 鍋滅敤</a> ", (object) gwSp.SpID ) : str1 + string.Format("<a href=\"javascript:;\" data-spid=\"{0}\" data-status=\"1\" class=\"action-updateStatus btn btn-default btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 鍚敤</a> ", (object) gwSp.SpID ); + str1 = gwSp.Status != 0 ? str1 + string.Format(" <a style='margin-top:5px;' href=\"javascript:;\" data-spid=\"{0}\" data-status=\"0\" class=\"action-updateStatus btn btn-primary btn-xs\"><i class=\"fa fa-toggle-off\"></i> 鍋滅敤</a><br> ", (object) gwSp.SpID ) : str1 + string.Format("<a href=\"javascript:;\" data-spid=\"{0}\" data-status=\"1\" class=\"action-updateStatus btn btn-default btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 鍚敤</a><br> ", (object) gwSp.SpID ); if (context.HasRight("3021")) - str1 += string.Format(" <a class=\"btn btn-xs btn-success action-modal-charge\" data-id=\"{0}\"><i class=\"fa fa-cny\"></i> 鍏呭��</a>", (object)gwSp.SpID); + str1 += string.Format(" <a style='margin-top:5px;' class=\"btn btn-xs btn-success action-modal-charge\" data-id=\"{0}\"><i class=\"fa fa-cny\"></i> 鍏呭��</a>", (object)gwSp.SpID); if (context.HasRight("3022")) - str1 += string.Format(" <a class=\" btn btn-success btn-xs action-modal-Acctunchargelog\" data-id=\"{0}\"><i class=\"fa fa-list-alt\"></i> 鍏呭�兼棩蹇�</a>", (object)gwSp.SpID); - + str1 += string.Format(" <a style='margin-top:5px;' class=\" btn btn-success btn-xs action-modal-Acctunchargelog\" data-id=\"{0}\"><i class=\"fa fa-list-alt\"></i> 鍏呭�兼棩蹇�</a>", (object)gwSp.SpID); + //if (context.HasRight("3024")) // str1 += string.Format(" <a class=\"btn-block btn btn-xs btn-default action-delete\" data-id=\"{0}\"><i class=\"fa fa-trash\"></i> 鍒犻櫎</a>", (object)gwSp.SpID); str1 += "</td>"; @@ -405,7 +407,7 @@ } } else - str1 += "<tr><td colspan=\"17\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; + str1 += "<tr><td colspan=\"14\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>"; return new JsonPageResult(true, (object)new { Table = str1.ToString(), @@ -504,8 +506,8 @@ private string GetStatusText(int status, string spid) { if (status == 0) - return string.Format("<span class='label label-default'>宸插仠鐢�</span>"); - //return string.Format("<span class=\"action-updateStatus btn btn-xs btn-default\" data-status=\"1\" data-spid=\"{0}\">宸插仠鐢�</span>", (object)spid); + return string.Format("<span class='label label-default'>宸插仠鐢�</span>"); + //return string.Format("<span class=\"action-updateStatus btn btn-xs btn-default\" data-status=\"1\" data-spid=\"{0}\">宸插仠鐢�</span>", (object)spid); //return string.Format("<span class=\"action-updateStatus btn btn-xs btn-success \" data-status=\"0\" data-spid=\"{0}\">宸插惎鐢�</span>", (object)spid); return string.Format("<span class='label label-success'>宸插惎鐢�</span>"); } @@ -591,7 +593,7 @@ o.AccessCode = context.GetString("AccessCode"); o.Priority = context.GetInt("Priority", 0); o.Price = Math.Max((int)(context.GetDecimal("Price", new Decimal(4, 0, 0, false, (byte)2)) * new Decimal(1000)), 1); - //o.ChargeType = context.GetInt("ChargeType", 0); + o.ChargeType = context.GetInt("ChargeType", 0); o.IsAutoReturn = context.GetInt("IsAutoReturn", 0); o.Threshold = Math.Max(context.GetInt("Threshold", 10), 10); o.MaxConnCount = context.GetInt("MaxConnCount", 1); @@ -605,7 +607,7 @@ o.Signatures = context.GetString("Signatures"); o.AuditingMode = context.GetInt("AuditingMode"); o.DeductPercent = context.GetInt("DeductPercent"); - + o.SubPackageNum = context.GetInt("SubPackageNum"); o.SingleSubmitMinRestrict = context.GetInt("SingleSubmitMinRestrict"); o.IsDispalyPrice = context.GetInt("IsDispalyPrice"); @@ -617,6 +619,8 @@ o.CumulativeAuditNum = context.GetInt("CumulativeAuditNum"); o.CumulativeAuditTime = context.GetInt("CumulativeAuditTime"); o.IsSyncChildSendAudit = context.GetInt("IsSyncChildSendAudit"); + + o.ProductId = context.GetString("ProductId","");//浜у搧ID if (context.GetInt("RouterType", 1) == 1) { @@ -659,8 +663,8 @@ o.CUGroupID = 0; o.CTGroupID = 0; } - o.BalanceThreshold = context.GetInt("BalanceThreshold") * 1000; - o.AlarmMobile = context.GetString("AlarmMobile"); + o.BalanceThreshold = context.GetInt("BalanceThreshold");//鍛婅鏉℃暟 + o.AlarmMobile = context.GetString("AlarmMobile");//鍛婅鍙风爜 o.ForceSignFlag = context.GetInt("ForceSignFlag"); o.ForceSign = context.GetString("ForceSign"); o.SignatureMode = context.GetInt("signatureMode"); @@ -685,9 +689,9 @@ cTPattern.SpID = context.GetString("SpID"); cTPattern.Enabled = context.GetInt("enabled"); cTPattern.Pattern = context.GetString("patternContent"); - string pattern = @"^[A-Za-z0-9]+$"; //鍒ゆ柇鏄瓧绗︽垨鏁板瓧 - //if (!Regex.IsMatch(o.SpID, "^\\d{6}$")) - // throw new Exception("璐﹀彿蹇呴』涓�6浣嶆暟瀛楋紒"); + string pattern = @"^[A-Za-z0-9]+$"; //鍒ゆ柇鏄瓧绗︽垨鏁板瓧 + //if (!Regex.IsMatch(o.SpID, "^\\d{6}$")) + // throw new Exception("璐﹀彿蹇呴』涓�6浣嶆暟瀛楋紒"); if (!Regex.IsMatch(o.SpID, "^[A-Za-z0-9]{6}$")) throw new Exception("璐﹀彿蹇呴』涓�6浣嶅瓧绗︽垨鏁板瓧锛�"); if (o.AccessCodeMode == 1) @@ -711,6 +715,27 @@ throw new Exception("璐﹀彿瀵嗙爜涓嶈兘涓虹┖"); this._Dao.Update(o); this._Dao.UpdatePattern(cTPattern, context.OperatorID); //鏇存柊璐﹀彿閲岄潰鐨勬姤澶囧唴瀹� + + //鍚屾椂淇敼瀹㈡埛-浜у搧琛ㄨ褰曪紝鑻ュ瓨鍦紝鍒欐洿鏂帮紝鍚﹀垯鏂板缓 + bool flag = GwClientProductDao.Instance.FindBySp(o.SpID); + GwClientProduct clientProduct = new GwClientProduct() + { + ClientId = o.ClientID, + ProductId = o.ProductId, + SpId = o.SpID, + ActivateStatus = 1, + Id=Guid.NewGuid().ToString() + }; + if (flag)//瀛樺湪,鏇存柊 + { + GwClientProductDao.Instance.Update(clientProduct); + } + else + { + + GwClientProductDao.Instance.Add(clientProduct); + } + return new JsonPageResult(true, (object)("璐︽埛" + o.SpID + "淇敼鎴愬姛锛�")); } @@ -729,7 +754,7 @@ o.AccessCode = context.GetString("AccessCode"); o.Priority = context.GetInt("Priority", 0); o.Price = Math.Max((int)(context.GetDecimal("Price", new Decimal(4, 0, 0, false, (byte)2)) * new Decimal(1000)), 1); - //o.ChargeType = context.GetInt("ChargeType", 0); + o.ChargeType = context.GetInt("ChargeType", 0); o.IsAutoReturn = context.GetInt("IsAutoReturn", 0); o.Threshold = Math.Max(context.GetInt("Threshold", 10), 10); o.MaxConnCount = context.GetInt("MaxConnCount", 1); @@ -768,7 +793,7 @@ o.Signatures = context.GetString("signatures"); string string1 = context.GetString("SpID"); int @int = context.GetInt("enabled"); - + o.SubPackageNum = context.GetInt("SubPackageNum"); o.SingleSubmitMinRestrict = context.GetInt("SingleSubmitMinRestrict"); o.IsDispalyPrice = context.GetInt("IsDispalyPrice"); @@ -795,8 +820,8 @@ } string string2 = context.GetString("patternContent"); - if (!Regex.IsMatch(o.SpID, "^\\d{6}$")) - throw new Exception("璐﹀彿蹇呴』涓�6浣嶆暟瀛�"); + if (!Regex.IsMatch(o.SpID, "^[0-9a-zA-Z]{6}$")) + throw new Exception("璐﹀彿蹇呴』涓�6浣嶆暟瀛楀拰瀛楁瘝"); if (!string.IsNullOrEmpty(o.AccessCode) && !Regex.IsMatch(o.AccessCode, "^[0-9]*$")) throw new Exception("鎵╁睍鍙峰繀椤讳负鏁板瓧"); if (string.IsNullOrEmpty(o.ClientID)) @@ -813,6 +838,33 @@ throw new Exception("SPID宸茬粡瀛樺湪锛岃閲嶆柊濉啓锛�"); this._Dao.Add(o); this._Dao.UpdatePattern(string1, @int, string2, context.OperatorID);//娣诲姞璐﹀彿鐨勬椂鍊欓厤缃姤澶� + + + //濡傛灉閫夋嫨浜嗕骇鍝侊紝琛ㄧず鍒涘缓鐨勬椂鍊欏氨婵�娲汇�傚悗鍙板垱寤烘棤璧犻�� + if (!string.IsNullOrEmpty(o.ProductId)) + { + //鍚屾椂淇敼瀹㈡埛-浜у搧琛ㄨ褰曪紝鑻ュ瓨鍦紝鍒欐洿鏂帮紝鍚﹀垯鏂板缓 + bool flag = GwClientProductDao.Instance.FindBySp(o.SpID); + GwClientProduct clientProduct = new GwClientProduct() + { + ClientId = o.ClientID, + ProductId = o.ProductId, + SpId = o.SpID, + ActivateStatus = 1, + Id = Guid.NewGuid().ToString() + }; + if (flag)//瀛樺湪,鏇存柊 + { + GwClientProductDao.Instance.Update(clientProduct); + } + else + { + + GwClientProductDao.Instance.Add(clientProduct); + } + } + + return new JsonPageResult(true, (object)("璐︽埛" + o.SpID + "娣诲姞鎴愬姛锛�")); } @@ -882,14 +934,20 @@ private JsonPageResult BatchUpdateOp(PageContext<SysUser> context) { - int int1 = context.GetInt("cmopID"); - int int2 = context.GetInt("unopID"); - int int3 = context.GetInt("ctopID"); - int int4 = context.GetInt("cmGroupID"); - int int5 = context.GetInt("cuGroupID"); - int int6 = context.GetInt("ctGroupID"); + int cmOpId = context.GetInt("cmopID"); + int cuOpId = context.GetInt("unopID"); + int ctOpId = context.GetInt("ctopID"); + int cmGroupId = context.GetInt("cmGroupID"); + int cuGroupId = context.GetInt("cuGroupID"); + int ctGroupId = context.GetInt("ctGroupID"); + + if (cmOpId == 0 && cuOpId == 0 && ctOpId == 0 && cmGroupId ==0 && cuGroupId==0 &&ctGroupId==0) + { + throw new ArgumentException("閫夐」涓嶅厑璁稿叏閮ㄤ负绌猴紝璇疯嚦灏戦�夋嫨涓�椤癸紒"); + } + foreach (string spid in JsonConvert.DeserializeObject<string[]>(context.GetString("idArray"))) - this._Dao.UpdateSingleOP(spid, int1, int3, int2, int4, int5, int6); + this._Dao.UpdateSingleOP(spid, cmOpId, ctOpId, cuOpId, cmGroupId, cuGroupId, ctGroupId); return new JsonPageResult(true, (object)"鎵归噺淇敼閫氶亾鎴愬姛锛�"); } -- Gitblit v1.9.1