From 94f6f81692eee7567e24be26e63bc30460307cbd Mon Sep 17 00:00:00 2001 From: yzh <snbbt@21cn.com> Date: 星期一, 23 五月 2022 13:48:20 +0800 Subject: [PATCH] 客户归属权限优化 --- web/web/Bin/Dao.dll | 0 web/web/GwStatisV3.ashx | 8 +- web/Dao/GwStatisV3Dao.cs | 1 web/web/GwStatisProfit.aspx.cs | 12 +++- web/web/ExportDocument.aspx.cs | 16 ++++- web/web/gwspupdate.aspx.cs | 12 +++ web/web/GwStatisRefund.aspx.cs | 10 ++ web/web/GwSp.ashx | 6 + web/Dao/GwClientDao.cs | 6 + web/Lib/Dao.dll | 0 web/Dao/GwSpDao.cs | 8 ++ web/web/GwMoRoute.aspx.cs | 15 ++++ web/web/GwClient.aspx | 5 + web/web/GwStatis.aspx.cs | 18 +++++- web/web/GwStatisV3.aspx.cs | 21 +++++- web/Lib/Dao.pdb | 0 web/web/Bin/Dao.pdb | 0 17 files changed, 109 insertions(+), 29 deletions(-) diff --git a/web/Dao/GwClientDao.cs b/web/Dao/GwClientDao.cs index 54ac667..cae844f 100644 --- a/web/Dao/GwClientDao.cs +++ b/web/Dao/GwClientDao.cs @@ -107,7 +107,7 @@ /** * 鏌ヨ缁熻鍔熻兘 */ - public List<GwClient> LoadInfoList(string clientID, string clientName, string company, string agent) + public List<GwClient> LoadInfoList(string clientID, string clientName, string company, string agent, string permissionsSQL) { @@ -141,6 +141,10 @@ ((DbParameter)oracleParameterArray[3]).Value = (object)("%" + agent + "%"); stringBuilder.Append(" and Agent like :Agent"); } + + //瀹㈡埛鏉冮檺SQL鑴氭湰 + stringBuilder.Append(permissionsSQL); + stringBuilder.Append(" order by CREATE_TIME DESC,CLIENT_ID DESC"); using (OracleDataReader reader = OracleHelper.ExecuteReader("select * " + stringBuilder.ToString(), OracleHelper.Connection, oracleParameterArray)) { diff --git a/web/Dao/GwSpDao.cs b/web/Dao/GwSpDao.cs index 7bfd4a5..492f708 100644 --- a/web/Dao/GwSpDao.cs +++ b/web/Dao/GwSpDao.cs @@ -208,7 +208,7 @@ return OracleHelper.Execute(PubConstant.doOracleSql(100000, stringBuilder.ToString()).ToString(), OracleHelper.Connection, oracleParameterArray); } - public List<GwSp> LoadInfoList(string spId, string apId, string clientId) + public List<GwSp> LoadInfoList(string spId, string apId, string clientId, string permissionsSQL) { List<GwSp> list1 = new List<GwSp>(); StringBuilder stringBuilder = new StringBuilder(); @@ -232,7 +232,11 @@ list2.Add(new OracleParameter(":ClientID", (object) clientId)); stringBuilder.Append(" and CLIENT_ID=:ClientID"); } - stringBuilder.Append(" order by SP_ID DESC"); + + //瀹㈡埛鏉冮檺SQL鑴氭湰 + stringBuilder.Append(permissionsSQL); + + stringBuilder.Append(" order by SP_ID DESC"); using (OracleDataReader reader = OracleHelper.ExecuteReader("select * " + stringBuilder.ToString(), OracleHelper.Connection, list2.ToArray())) { while (((DbDataReader) reader).Read()) diff --git a/web/Dao/GwStatisV3Dao.cs b/web/Dao/GwStatisV3Dao.cs index 7d14e5b..f177d7a 100644 --- a/web/Dao/GwStatisV3Dao.cs +++ b/web/Dao/GwStatisV3Dao.cs @@ -18,6 +18,7 @@ return OracleHelper.Execute("SELECT * FROM\r\n(\r\nselect STATIS_TIME,\r\nNVL(SUM(AP_STATUS0),0) as AP_STATUS0,\r\nNVL(SUM(AP_STATUS1),0) as AP_STATUS1,\r\nNVL(SUM(AP_STATUS2),0) as AP_STATUS2,\r\nNVL(SUM(AP_STATUS3),0) as AP_STATUS3,\r\nNVL(SUM(AP_STATUS4),0) as AP_STATUS4,\r\nNVL(SUM(AP_STATUS5),0) as AP_STATUS5\r\n from GW_SM_STATIS_V3 where CLIENT_ID=:CLIENT_ID GROUP BY STATIS_TIME ORDER BY STATIS_TIME DESC) WHERE ROWNUM < 30 ORDER BY STATIS_TIME ASC", OracleHelper.Connection, new OracleParameter(":CLIENT_ID", (object) clientID)); } + //public List<GwStatisV3Item> Query(DateTime startTime, DateTime endTime, string clientID, string spID, string apID, string opID, string timeExpression, StatisOption so) public List<GwStatisV3Item> Query(DateTime startTime, DateTime endTime, string clientID, string spID, string apID, string opID, string timeExpression, string permissionsSQL, StatisOption so) { List<GwStatisV3Item> list = new List<GwStatisV3Item>(); diff --git a/web/Lib/Dao.dll b/web/Lib/Dao.dll index 248ff7b..8d5e470 100644 --- a/web/Lib/Dao.dll +++ b/web/Lib/Dao.dll Binary files differ diff --git a/web/Lib/Dao.pdb b/web/Lib/Dao.pdb index edbd3fb..9adeddd 100644 --- a/web/Lib/Dao.pdb +++ b/web/Lib/Dao.pdb Binary files differ diff --git a/web/web/Bin/Dao.dll b/web/web/Bin/Dao.dll index 248ff7b..8d5e470 100644 --- a/web/web/Bin/Dao.dll +++ b/web/web/Bin/Dao.dll Binary files differ diff --git a/web/web/Bin/Dao.pdb b/web/web/Bin/Dao.pdb index edbd3fb..9adeddd 100644 --- a/web/web/Bin/Dao.pdb +++ b/web/web/Bin/Dao.pdb Binary files differ diff --git a/web/web/ExportDocument.aspx.cs b/web/web/ExportDocument.aspx.cs index cb43a1c..6ad04c7 100644 --- a/web/web/ExportDocument.aspx.cs +++ b/web/web/ExportDocument.aspx.cs @@ -10,10 +10,17 @@ public partial class ExportDocument : PageBase<SysUser>, IRequiresSessionState { - + + private int _userId = -1; + private int _userType = -1; + private string _account = ""; protected void Page_Load(object sender, EventArgs e) { + _userId = this.AppContext.SessionObject.UserID; + _userType = this.AppContext.SessionObject.UserType; + _account = this.AppContext.SessionObject.Account; + switch (this.AppContext.GetString("action")) { case "exPortGwSp": @@ -45,6 +52,8 @@ string statistype = this.AppContext.GetString("Statistype"); StatisOption statisoption = (StatisOption)this.AppContext.GetInt("Statisoption"); + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); + List<GwOp> opList; using (GwOpDao dao = new GwOpDao()) @@ -56,7 +65,7 @@ using (GwClientDao dao = new GwClientDao()) { - clientList = dao.LoadInfoList("", "", "", ""); + clientList = dao.LoadInfoList("", "", "", "", permissionsSQL); } List<GwAp> apList; @@ -68,8 +77,9 @@ apList = dao.LoadInfoList("", "", "", out recordCount, 99999, 1); } + GwStatisV3Dao _Dao = new GwStatisV3Dao(); - var list = _Dao.Query(Convert.ToDateTime(beginTime), Convert.ToDateTime(endTime), clientId, spid, apMid, opid, statistype, (StatisOption)statisoption); + var list = _Dao.Query(Convert.ToDateTime(beginTime), Convert.ToDateTime(endTime), clientId, spid, apMid, opid, statistype, permissionsSQL, (StatisOption)statisoption); List<Model.GwStatisV3> statisList = new List<Model.GwStatisV3>(); foreach (GwStatisV3Item item in list) diff --git a/web/web/GwClient.aspx b/web/web/GwClient.aspx index 0c8c2fc..ee6bba0 100644 --- a/web/web/GwClient.aspx +++ b/web/web/GwClient.aspx @@ -334,7 +334,7 @@ <div class="form-group"> <label class="control-label col-sm-2"> - 鍏徃鍚嶇О(鍏ㄧО) + 瀹㈡埛鍚嶇О <span style="color:red">*</span> </label> <div class="col-sm-4"> <input type="text" name="company" id="company" value="" class="form-control" /> @@ -352,11 +352,12 @@ </div> <div class="col-sm-6"> <a class="btn btn-xs btn-primary action-generate-password ">鐢熸垚瀵嗙爜</a> + <a class="btn btn-xs btn-success action-generate-password ">澶嶅埗瀵嗙爜</a> </div> </div> <div class="form-group"> <label class="control-label col-sm-2"> - 瀹㈡埛鍚嶇О <span style="color:red">*</span> + 鑱旂郴浜� <span style="color:red">*</span> </label> <div class="col-sm-4"> <input type="text" name="clientName" id="clientName" value="" class="form-control" /> diff --git a/web/web/GwMoRoute.aspx.cs b/web/web/GwMoRoute.aspx.cs index 948a8bf..8fdc48a 100644 --- a/web/web/GwMoRoute.aspx.cs +++ b/web/web/GwMoRoute.aspx.cs @@ -12,7 +12,11 @@ public partial class _GwMoRoute : PageBase<SysUser>, IRequiresSessionState { private List<GwOp> OpList; - + + private int _userId = -1; + private int _userType = -1; + private string _account = ""; + public GwSp GwSp { get; protected set; } public string SpID @@ -30,6 +34,11 @@ protected void Page_Load(object sender, EventArgs e) { this.CheckRight("306", FailedOperation.ErrorMsgOnly); + + _userId = this.AppContext.SessionObject.UserID; + _userType = this.AppContext.SessionObject.UserType; + _account = this.AppContext.SessionObject.Account; + using (GwSpDao gwSpDao = new GwSpDao()) { if (!string.IsNullOrEmpty(this.SpID)) @@ -83,7 +92,9 @@ StringBuilder stringBuilder = new StringBuilder(); using (GwSpDao gwSpDao = new GwSpDao()) { - List<GwSp> list = gwSpDao.LoadInfoList("", "", ""); + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); + + List<GwSp> list = gwSpDao.LoadInfoList("", "", "", permissionsSQL); if (list.Count == 0) { stringBuilder.Append("<option value=\"\">鏆傛棤甯愬彿</option>"); diff --git a/web/web/GwSp.ashx b/web/web/GwSp.ashx index 885c466..25423cb 100644 --- a/web/web/GwSp.ashx +++ b/web/web/GwSp.ashx @@ -57,8 +57,10 @@ { if (this._ClientList == null) { - using (GwClientDao gwClientDao = new GwClientDao()) - this._ClientList = gwClientDao.LoadInfoList("", "", "", ""); + using (GwClientDao gwClientDao = new GwClientDao()) { + string permissionsSQL = gwClientDao.GetClientPermissions(_userId, _userType, null); + this._ClientList = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); + } } return this._ClientList; } diff --git a/web/web/GwStatis.aspx.cs b/web/web/GwStatis.aspx.cs index f62afac..0fbfedb 100644 --- a/web/web/GwStatis.aspx.cs +++ b/web/web/GwStatis.aspx.cs @@ -17,7 +17,11 @@ private List<GwClient> ClientList; private List<GwAp> ApList; - + private int _userId = -1; + private int _userType = -1; + private string _account = ""; + string permissionsSQL = null; + public StatisOption SelectedOptions { get; set; } @@ -38,10 +42,18 @@ protected void Page_Load(object sender, EventArgs e) { this.CheckRight("502", FailedOperation.ErrorMsgOnly); + + _userId = this.AppContext.SessionObject.UserID; + _userType = this.AppContext.SessionObject.UserType; + _account = this.AppContext.SessionObject.Account; + permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); + using (GwOpDao gwOpDao = new GwOpDao()) this.OpList = gwOpDao.LoadInfoList(); using (GwClientDao gwClientDao = new GwClientDao()) - this.ClientList = gwClientDao.LoadInfoList("", "", "", ""); + { + this.ClientList = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); + } using (GwApDao gwApDao = new GwApDao()) this.ApList = gwApDao.LoadInfoList(); if (this.IsPostBack) @@ -147,7 +159,7 @@ StringBuilder stringBuilder = new StringBuilder(); using (GwSpDao gwSpDao = new GwSpDao()) { - List<GwSp> list = gwSpDao.LoadInfoList("", "", ""); + List<GwSp> list = gwSpDao.LoadInfoList("", "", "", permissionsSQL); if (list.Count == 0) { stringBuilder.Append("<option value=\"\">鏆傛棤瀹㈡埛淇℃伅</option>"); diff --git a/web/web/GwStatisProfit.aspx.cs b/web/web/GwStatisProfit.aspx.cs index d7b8704..4dc827e 100644 --- a/web/web/GwStatisProfit.aspx.cs +++ b/web/web/GwStatisProfit.aspx.cs @@ -15,7 +15,10 @@ private List<GwClient> ClientList; private List<GwAp> ApList; - + private int _userId = -1; + private int _userType = -1; + private string _account = ""; + string permissionsSQL = null; public StatisOption SelectedOptions { get; set; } @@ -32,10 +35,13 @@ protected void Page_Load(object sender, EventArgs e) { this.CheckRight("502", FailedOperation.ErrorMsgOnly); + permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); using (GwOpDao gwOpDao = new GwOpDao()) this.OpList = gwOpDao.LoadInfoList(); using (GwClientDao gwClientDao = new GwClientDao()) - this.ClientList = gwClientDao.LoadInfoList("", "", "", ""); + { + this.ClientList = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); + } using (GwApDao gwApDao = new GwApDao()) this.ApList = gwApDao.LoadInfoList(); if (this.IsPostBack) @@ -70,7 +76,7 @@ StringBuilder stringBuilder = new StringBuilder(); using (GwSpDao gwSpDao = new GwSpDao()) { - List<GwSp> list = gwSpDao.LoadInfoList("", "", ""); + List<GwSp> list = gwSpDao.LoadInfoList("", "", "", permissionsSQL); if (list.Count == 0) { stringBuilder.Append("<option value=\"\">鏆傛棤甯愬彿淇℃伅</option>"); diff --git a/web/web/GwStatisRefund.aspx.cs b/web/web/GwStatisRefund.aspx.cs index 93600d0..fd1277c 100644 --- a/web/web/GwStatisRefund.aspx.cs +++ b/web/web/GwStatisRefund.aspx.cs @@ -11,7 +11,12 @@ public partial class _GwStatisRefund : PageBase<SysUser>, IRequiresSessionState { - + + private int _userId = -1; + private int _userType = -1; + private string _account = ""; + string permissionsSQL = null; + public string SelectedSpID { get; set; } public string StatisType { get; set; } @@ -25,6 +30,7 @@ protected void Page_Load(object sender, EventArgs e) { this.CheckRight("502", FailedOperation.ErrorMsgOnly); + permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); if (this.IsPostBack) return; this.SelectedOptions = StatisOption.None; @@ -38,7 +44,7 @@ StringBuilder stringBuilder = new StringBuilder(); using (GwSpDao gwSpDao = new GwSpDao()) { - List<GwSp> list = gwSpDao.LoadInfoList("", "", ""); + List<GwSp> list = gwSpDao.LoadInfoList("", "", "", permissionsSQL); if (list.Count == 0) { stringBuilder.Append("<option value=\"\">鏆傛棤瀹㈡埛淇℃伅</option>"); diff --git a/web/web/GwStatisV3.ashx b/web/web/GwStatisV3.ashx index 0604141..752c2e1 100644 --- a/web/web/GwStatisV3.ashx +++ b/web/web/GwStatisV3.ashx @@ -81,6 +81,8 @@ string opID = context.GetString("opid"); string statistype = context.GetString("statistype"); StatisOption statisoption = (StatisOption)context.GetInt("statisoption"); + + string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); List<GwOp> opList; @@ -93,7 +95,7 @@ using (GwClientDao dao = new GwClientDao()) { - clientList = dao.LoadInfoList("", "", "", ""); + clientList = dao.LoadInfoList("", "", "", "", permissionsSQL); } List<GwAp> apList; @@ -104,10 +106,10 @@ apList = dao.LoadInfoList("", "", "", out recordCount, 99999, 1); } + + //var list = _Dao.Query(beginTime, endTime, clientID, spID, apID, opID, statistype, (StatisOption)statisoption); //鏍规嵁绯荤粺鐢ㄦ埛鑾峰彇鏈夋潈闄愬鎴� - string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); - var list = _Dao.Query(beginTime, endTime, clientID, spID, apID, opID, statistype, permissionsSQL, (StatisOption)statisoption); System.Text.StringBuilder sb = new System.Text.StringBuilder(); diff --git a/web/web/GwStatisV3.aspx.cs b/web/web/GwStatisV3.aspx.cs index 315b738..8d91f33 100644 --- a/web/web/GwStatisV3.aspx.cs +++ b/web/web/GwStatisV3.aspx.cs @@ -14,7 +14,12 @@ private List<GwOp> OpList; private List<GwClient> ClientList; private List<GwAp> ApList; - + + private int _userId = -1; + private int _userType = -1; + private string _account = ""; + string permissionsSQL = null; + public StatisOption SelectedOptions { get; set; } public DateTime StartTime { get; set; } @@ -34,10 +39,18 @@ protected void Page_Load(object sender, EventArgs e) { this.CheckRight("502", FailedOperation.ErrorMsgOnly); + + _userId = this.AppContext.SessionObject.UserID; + _userType = this.AppContext.SessionObject.UserType; + _account = this.AppContext.SessionObject.Account; + permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null); + using (GwOpDao gwOpDao = new GwOpDao()) this.OpList = gwOpDao.LoadInfoList(); using (GwClientDao gwClientDao = new GwClientDao()) - this.ClientList = gwClientDao.LoadInfoList("", "", "", ""); + { + this.ClientList = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); + } using (GwApDao gwApDao = new GwApDao()) this.ApList = gwApDao.LoadInfoList(); if (this.IsPostBack) @@ -75,7 +88,7 @@ return string.Empty; GwClient gwClient = this.ClientList.Find((Predicate<GwClient>)(client => client.ClientID == clientID)); if (gwClient != null) - return string.Format("{0}-{1}", (object)gwClient.ClientID, (object)gwClient.ClientName); + return string.Format("{0}", (object)gwClient.ClientName); return string.Format("{0}", (object)clientID); } @@ -138,7 +151,7 @@ StringBuilder stringBuilder = new StringBuilder(); using (GwSpDao gwSpDao = new GwSpDao()) { - List<GwSp> list = gwSpDao.LoadInfoList("", "", ""); + List<GwSp> list = gwSpDao.LoadInfoList("", "", "", permissionsSQL); if (list.Count == 0) { stringBuilder.Append("<option value=\"\">鏆傛棤瀹㈡埛淇℃伅</option>"); diff --git a/web/web/gwspupdate.aspx.cs b/web/web/gwspupdate.aspx.cs index 3eedc3b..512c294 100644 --- a/web/web/gwspupdate.aspx.cs +++ b/web/web/gwspupdate.aspx.cs @@ -14,6 +14,9 @@ protected List<GwOp> OpList; protected List<GwProduct> GwProductList; + private int _userId = -1; + private int _userType = -1; + private string _account = ""; public GwSp GwSp { get; protected set; } @@ -38,6 +41,10 @@ protected void Page_Load(object sender, EventArgs e) { + _userId = this.AppContext.SessionObject.UserID; + _userType = this.AppContext.SessionObject.UserType; + _account = this.AppContext.SessionObject.Account; + using (GwApDao gwApDao = new GwApDao()) this.ApList = gwApDao.LoadInfoList(); using (GwOpDao gwOpDao = new GwOpDao()) @@ -185,8 +192,9 @@ { using (GwClientDao gwClientDao = new GwClientDao()) { + string permissionsSQL = gwClientDao.GetClientPermissions(_userId, _userType, null); string str = ""; - List<GwClient> list = gwClientDao.LoadInfoList("", "", "", ""); + List<GwClient> list = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); if (list.Count == 0) { str += string.Format("<option value=\"\">灏氭湭鍒涘缓瀹㈡埛淇℃伅</option>"); @@ -194,7 +202,7 @@ else { foreach (GwClient gwClient in list) - str = !(clientId == gwClient.ClientID) ? str + string.Format("<option value=\"{0}\">{0}-{1}</option>", (object)gwClient.ClientID, (object)gwClient.ClientName) : str + string.Format("<option value=\"{0}\" selected>{0}-{1}</option>", (object)gwClient.ClientID, (object)gwClient.ClientName); + str = !(clientId == gwClient.ClientID) ? str + string.Format("<option value=\"{0}\">{1}</option>", (object)gwClient.ClientID, (object)gwClient.ClientName) : str + string.Format("<option value=\"{0}\" selected>{1}</option>", (object)gwClient.ClientID, (object)gwClient.ClientName); } return str; } -- Gitblit v1.9.1