From f2fa318161407b936f70aa3b918dd38f24ea9a88 Mon Sep 17 00:00:00 2001
From: yzh <snbbt@21cn.com>
Date: 星期一, 13 六月 2022 07:08:28 +0800
Subject: [PATCH] 数据字典表相关功能 系统账号管理优化 订单管理 API账号管理 客户信息管理

---
 web/web/GwSp.ashx |  151 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 120 insertions(+), 31 deletions(-)

diff --git a/web/web/GwSp.ashx b/web/web/GwSp.ashx
index 8dc0a8b..26d653d 100644
--- a/web/web/GwSp.ashx
+++ b/web/web/GwSp.ashx
@@ -19,6 +19,11 @@
     private List<GwDiverter> _DiverterList;
     private List<GwAp> _APList;
     private List<GwStrategy> _StrategyList;
+    private List<GwProduct> _ProductList;
+
+    private int _userId = -1;
+    private int _userType = -1;
+    private string _account = "";
 
     private List<GwOp> OpList
     {
@@ -52,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;
         }
@@ -85,6 +92,25 @@
         }
     }
 
+    private List<GwProduct> ProductList
+    {
+        get
+        {
+            if (this._ProductList == null)
+            {
+                using (GwProductDao gwProductDao = new GwProductDao())
+                {
+                    GwProduct gwProduct = new GwProduct();
+                        gwProduct.Classes = -1;
+                        gwProduct.IsDefault = -1;
+                        gwProduct.IsEnable = -1;
+                    this._ProductList = gwProductDao.getAllList(gwProduct);
+                }
+            }
+            return this._ProductList;
+        }
+    }
+
     private List<GwStrategy> StrategyList
     {
         get
@@ -101,6 +127,10 @@
     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 "updateSpStatus":
@@ -123,7 +153,7 @@
                 return this.Add(context);
             case "loadGwSpPageList":
                 return this.LoadGwSpPageList(context);
-            case "loadGwSpAccountPageList":
+            case "loadGwSpAccountPageList"://鍔犺浇璐﹀彿鍒楄〃
                 return this.LoadGwSpAccountPageList(context);
             case "update":
                 return this.Update(context);
@@ -284,55 +314,64 @@
         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("璇烽�夋嫨閫氶亾缁勮矾鐢辨ā寮�");
         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;
+        //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, int1, string3, int2, int4, int3, out recordCount);
+        List<GwSp> list = gwSpDao.LoadInfoList(string2, apId, clientId, string4, int1, string3, int2, int4, int3, int5.ToString(), productId, permissionsSQL, out recordCount);
         string str1 = "";
         if (list != null && list.Count > 0)
         {
             foreach (GwSp gwSp in list)
             {
-                str1 = str1 + "<tr><td  rowspan=\"1\" ><input type=\"checkbox\"name=\"checkbox\" value=\"" + gwSp.SpID + "\"/></td><td rowspan=\"1\">" + gwSp.SpID + "<div class=\"text-muted\">" + this.GetAPName(gwSp.ApID) + "</div><div class=\"text-muted\">" + this.GetClientName(gwSp.ClientID) + "</div>";
-                str1 += "</td>";
+                //str1 = str1 + "<tr><td  rowspan=\"1\" ><input type=\"checkbox\"name=\"checkbox\" value=\"" + gwSp.SpID + "\"/></td><td rowspan=\"1\">" + gwSp.SpID + "<div class=\"text-muted\">" + this.GetAPName(gwSp.ApID) + "</div><div class=\"text-muted\">" + this.GetClientName(gwSp.ClientID) + "</div>";
+                str1 += "<tr><td  rowspan=\"1\" ><input type=\"checkbox\"name=\"checkbox\" value=\"" + gwSp.SpID + "\"/></td><td rowspan=\"1\">" + gwSp.SpID + "</td>";
+                str1 += "<td>" + (object)this.GetProductToName(gwSp.ProductId) + "</td>";
+                str1 += "<td>" + (object)gwSp.ClientID + "</td>";
+                str1 += "<td>" + (object)this.GetClientName(gwSp.ClientID) + "</td>";
+                str1 += "<td>" + (object)this.GetAPName(gwSp.ApID) + "</td>";
                 if (gwSp.RouterType == 1)
                 {
-                    str1 += "<td rowspan=\"1\"><div class=\"btn  btn-primary btn-xs\">鐐硅矾鐢�</div>";
+                    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));
                 }
                 else if (gwSp.RouterType == 3)
                 {
-                    str1 += "<td rowspan=\"1\"><div class=\"btn  btn-success  btn-xs\">缁勮矾鐢�</div>";
+                    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));
                 }
 
                 if (gwSp.RESEND_STATUS == 1)
                 {
-                    str1 += "<td rowspan=\"1\"><div class=\"btn  btn-primary  btn-xs\">鍚敤澶辫触琛ュ彂</div>";
+                    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.RESEND_CM_GROUPID), (object)this.GetGroupName(gwSp.RESEND_CU_GROUPID), (object)this.GetGroupName(gwSp.RESEND_CT_GROUPID));
                     //璐︽埛椤甸潰鏄剧ず琛ュ彂閫氶亾鍏蜂綋鐨勯�氶亾
                 }
                 else
                 {
-                    str1 += "<td rowspan=\"1\"><div class=\"btn  btn-danger  btn-xs\">鍋滅敤澶辫触琛ュ彂</div>";
+                    str1 += "<td rowspan=\"1\"><span class='label label-danger'>鍋滅敤澶辫触琛ュ彂</span>";
                 }
 
 
-                string str2 = "<div class=\"text-muted\">" + gwSp.ChargerTypeText + "</div>";
+                string str2 = gwSp.ChargerTypeText ;
                 if (gwSp.ChargerTypeText == "鍚庝粯璐�")
                     str2 = "<div  style=\"color:red\">" + gwSp.ChargerTypeText + "</div>";
-                str1 = str1 + (object)"<td><div class=\"text-muted\">" + (object)(gwSp.Balance / (long)gwSp.Price) + "鏉�/" + (object)((double)gwSp.Balance / 1000.0) + "鍏�</div>";
-                str1 = str1 + (object)str2 + "<div class=\"text-muted\">" + (object)((double)gwSp.Price / 1000.0) + "鍏�/鏉�</div>";
-                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);
-                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 += "<td>" + str2 + "</td>";
+                str1 += "<td>" + (object)((double)gwSp.Price / 1000.0) + "</td>";
+                //add: yangzh by 2022-03-14 start
+                //str1 = str1 + (object)"<td><div class=\"text-muted\">" + (object)(gwSp.Balance / (long)gwSp.Price) + "鏉�/" + (object)((double)gwSp.Balance / 1000.0) + "鍏�</div>";
+                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 += "</td>";
@@ -348,18 +387,25 @@
                 // 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\">";
                 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 class=\"btn-block btn btn-success btn-xs action-create-summary\" data-id=\"{0}\">璐﹀彿鎽樿</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 += 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>&nbsp;鍋滅敤</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>&nbsp;鍚敤</a> ", (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);
+                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);
+                
+                //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>";
                 str1 += "</tr>";
             }
         }
         else
-            str1 += "<tr><td colspan=\"14\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+            str1 += "<tr><td colspan=\"17\" style=\"padding-left:5px; text-align: center;\">鏆傛棤淇℃伅</td></tr>";
         return new JsonPageResult(true, (object)new
         {
             Table = str1.ToString(),
@@ -406,7 +452,7 @@
         if (gwAp != null)
         {
             //return string.Format("{0}-{1}", (object)gwAp.ApID, (object)gwAp.ApName);//2021.2.24.wzp鍙樻洿,鍚庣画鍙互鍒犻櫎
-            return string.Format("鎺ュ叆鍗忚:{0}", (object)gwAp.ApName);
+            return string.Format("{0}", (object)gwAp.ApName);
         }
         return string.Empty;
     }
@@ -437,7 +483,7 @@
             return string.Empty;
         GwClient gwClient = this.ClientList.Find((Predicate<GwClient>)(client => client.ClientID == clientID));
         if (gwClient != null)
-            return string.Format("{0}<div class=\"text-muted\">{1}</div>", (object)gwClient.ClientID, (object)gwClient.ClientName);
+            return string.Format("{0}", (object)gwClient.Company);
         return string.Format("{0}", (object)clientID);
     }
 
@@ -458,8 +504,10 @@
     private string GetStatusText(int status, string spid)
     {
         if (status == 0)
-            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-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>");
     }
     //
 
@@ -477,6 +525,17 @@
         if (gwDiverter == null)
             return "鏈缃娴�";
         return "銆�" + gwDiverter.DiverterName + "銆戝娴佺瓥鐣�";
+    }
+
+    //浜у搧杞悕绉�
+    private string GetProductToName(string productId)
+    {
+        GwProduct gwProduct = this.ProductList.Find((Predicate<GwProduct>)(bean => productId.Equals(bean.Id) ));
+        if (gwProduct != null)
+        {
+            return string.Format("{0}", (object)gwProduct.Name);
+        }
+        return productId;
     }
 
     private JsonPageResult LoadGwSpPageList(PageContext<SysUser> context)
@@ -532,7 +591,8 @@
         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);
         o.Remark = context.GetString("Remark");
@@ -545,6 +605,19 @@
         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");
+        o.DeductionMode = context.GetInt("DeductionMode");
+        o.IsSendAudit = context.GetInt("IsSendAudit");
+        o.BelowNumAudit = context.GetInt("BelowNumAudit");
+        o.AboveNumAudit = context.GetInt("AboveNumAudit");
+        o.IsCumulativeAudit = context.GetInt("IsCumulativeAudit");
+        o.CumulativeAuditNum = context.GetInt("CumulativeAuditNum");
+        o.CumulativeAuditTime = context.GetInt("CumulativeAuditTime");
+        o.IsSyncChildSendAudit = context.GetInt("IsSyncChildSendAudit");
+
         if (context.GetInt("RouterType", 1) == 1)
         {
             o.CMOPID = context.GetInt("CMOPID");
@@ -612,8 +685,11 @@
         cTPattern.SpID = context.GetString("SpID");
         cTPattern.Enabled = context.GetInt("enabled");
         cTPattern.Pattern = context.GetString("patternContent");
-        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)
         {
             if (o.DiverterID != 0)
@@ -653,7 +729,8 @@
         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);
         o.Remark = context.GetString("Remark");
@@ -691,6 +768,18 @@
         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");
+        o.DeductionMode = context.GetInt("DeductionMode");
+        o.IsSendAudit = context.GetInt("IsSendAudit");
+        o.BelowNumAudit = context.GetInt("BelowNumAudit");
+        o.AboveNumAudit = context.GetInt("AboveNumAudit");
+        o.IsCumulativeAudit = context.GetInt("IsCumulativeAudit");
+        o.CumulativeAuditNum = context.GetInt("CumulativeAuditNum");
+        o.CumulativeAuditTime = context.GetInt("CumulativeAuditTime");
+        o.IsSyncChildSendAudit = context.GetInt("IsSyncChildSendAudit");
 
         o.VerCodeMode = context.GetInt("VerCodeMode");
         o.ProvincialNetworkMode = context.GetInt("ProvincialNetworkMode");

--
Gitblit v1.9.1