From 2f74eb23c0d2d4a246bc612c5c34bdfa8dea5603 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期五, 11 十一月 2022 09:25:02 +0800
Subject: [PATCH] 修改账号产品关联的bug 修改产品不显示的bug

---
 web/Lib/Dao.dll               |    0 
 web/web/Bin/Dao.dll           |    0 
 web/web/GwProduct.ashx        |    4 +-
 web/.vs/Web/v16/.suo          |    0 
 web/web/GwSp.ashx             |   54 +++++++++++++++++++++++++-
 web/Dao/GwClientProductDao.cs |   35 +++++++++++++++++
 web/Lib/Dao.pdb               |    0 
 web/web/Bin/Dao.pdb           |    0 
 8 files changed, 87 insertions(+), 6 deletions(-)

diff --git a/web/.vs/Web/v16/.suo b/web/.vs/Web/v16/.suo
index b2cf165..b2cc19e 100644
--- a/web/.vs/Web/v16/.suo
+++ b/web/.vs/Web/v16/.suo
Binary files differ
diff --git a/web/Dao/GwClientProductDao.cs b/web/Dao/GwClientProductDao.cs
index 7df596f..443b4b8 100644
--- a/web/Dao/GwClientProductDao.cs
+++ b/web/Dao/GwClientProductDao.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Data.Common;
 using System.Linq;
 using System.Text;
 using Common;
@@ -32,9 +33,41 @@
         /// <returns></returns>
         public bool Add(GwClientProduct gcp)
         {
-            return OracleHelper.ExecuteSql("insert into GW_Client_Product(id,client_id,product_id) values(:id,:client_id,:product_id)", OracleHelper.Connection, new OracleParameter(":id", (object)gcp.Id), new OracleParameter(":client_id", (object)gcp.ClientId), new OracleParameter(":product_id", (object)gcp.ProductId)) > 0;
+            return OracleHelper.ExecuteSql("insert into GW_Client_Product(id,client_id,product_id,sp_id,ACTIVATE_STATUS) values(:id,:client_id,:product_id,:sp_id,:ACTIVATE_STATUS)",
+                OracleHelper.Connection, new OracleParameter(":id", (object)gcp.Id), new OracleParameter(":client_id", (object)gcp.ClientId), 
+                new OracleParameter(":product_id", gcp.ProductId),new OracleParameter(":sp_id",gcp.SpId),
+                new OracleParameter(":ACTIVATE_STATUS", gcp.ActivateStatus)) > 0;
         }
 
+        /// <summary>
+        /// 鏇存柊
+        /// </summary>
+        /// <param name="gcp"></param>
+        /// <returns></returns>
+        public bool Update(GwClientProduct gcp)
+        {
+            return OracleHelper.ExecuteSql("update GW_Client_Product set product_id=:product_id,client_id=:client_id where sp_id=:sp_id ", 
+                OracleHelper.Connection, new OracleParameter(":product_id", gcp.ProductId), new OracleParameter(":sp_id", gcp.SpId),
+                new OracleParameter(":client_id",gcp.ClientId)
+                ) > 0;
+        }
+
+        /// <summary>
+        /// 鏌ユ壘璐﹀彿鏄惁瀛樺湪
+        /// </summary>
+        /// <param name="spid"></param>
+        /// <returns></returns>
+        public bool FindBySp(string spid)
+        {
+            using (OracleDataReader oracleDataReader = OracleHelper.ExecuteReader(string.Format("select * from GW_Client_Product where SP_ID=:SP_ID"), OracleHelper.Connection, new OracleParameter(":SP_ID", spid)))
+            {
+                if (oracleDataReader.Read())
+                    return true;
+            }
+            return false;
+        }
+        
+
 
     }
 }
diff --git a/web/Lib/Dao.dll b/web/Lib/Dao.dll
index 61af9c9..95c2d16 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 d75150c..64fb680 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 61af9c9..95c2d16 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 d75150c..64fb680 100644
--- a/web/web/Bin/Dao.pdb
+++ b/web/web/Bin/Dao.pdb
Binary files differ
diff --git a/web/web/GwProduct.ashx b/web/web/GwProduct.ashx
index c6048c6..1c965d3 100644
--- a/web/web/GwProduct.ashx
+++ b/web/web/GwProduct.ashx
@@ -88,12 +88,12 @@
                 if (bean.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(bean.CmOpId), (object)this.GetOpName(bean.CtOpId), (object)this.GetOpName(bean.CuOpId));
+                    str1 += string.Format("<div style='margin-top:10px;'>绉诲姩锛歿0}</div><div>鐢典俊锛歿1}</div><div>鑱旈�氾細{2}</div>", (object)this.GetOpName(bean.CmOpId), (object)this.GetOpName(bean.CtOpId), (object)this.GetOpName(bean.CuOpId));
                 }
                 else if (bean.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(bean.CmGroupid), (object)this.GetGroupName(bean.CtGroupid), (object)this.GetGroupName(bean.CuGroupid));
+                    str1 += string.Format("<div style='margin-top:10px;'>绉诲姩锛歿0}</div><div>鐢典俊锛歿1}</div><div>鑱旈�氾細{2}</div>", (object)this.GetGroupName(bean.CmGroupid), (object)this.GetGroupName(bean.CtGroupid), (object)this.GetGroupName(bean.CuGroupid));
                 }
                 else
                 {
diff --git a/web/web/GwSp.ashx b/web/web/GwSp.ashx
index 061d32c..feafff4 100644
--- a/web/web/GwSp.ashx
+++ b/web/web/GwSp.ashx
@@ -620,7 +620,7 @@
         o.CumulativeAuditTime = context.GetInt("CumulativeAuditTime");
         o.IsSyncChildSendAudit = context.GetInt("IsSyncChildSendAudit");
 
-        o.ProductId = context.GetString("ProductId","");
+        o.ProductId = context.GetString("ProductId","");//浜у搧ID
 
         if (context.GetInt("RouterType", 1) == 1)
         {
@@ -663,8 +663,8 @@
             o.CUGroupID = 0;
             o.CTGroupID = 0;
         }
-        o.BalanceThreshold = context.GetInt("BalanceThreshold");
-        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");
@@ -715,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 + "淇敼鎴愬姛锛�"));
     }
 
@@ -817,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 + "娣诲姞鎴愬姛锛�"));
     }
 

--
Gitblit v1.9.1