lcl 1 سال پیش
والد
کامیت
a0847c69c8

+ 1 - 0
AppStart/RabbitMQClient.cs

@@ -45,6 +45,7 @@ namespace MySystem
         #region 单对单发送
         public void SendMsg(string content, string QueueName = "")
         {
+            return;
             if (_connection == null)
             {
                 CreateConn();

+ 1 - 11
AppStart/Redis/Mysql/MerchantAddInfoDbconn.cs

@@ -12,22 +12,12 @@ namespace MySystem
         #region 获取单个字段
         public MerchantAddInfo Get(int Id)
         {
-            string key = "MerchantAddInfo:" + Id;
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                MerchantAddInfo obj = RedisDbconn.Instance.Get<MerchantAddInfo>(key);
-                if (obj != null)
-                {
-                    return obj;
-                }
-            }
             WebCMSEntities db = new WebCMSEntities();
             MerchantAddInfo order = db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id);
             if (order != null)
             {
-                RedisDbconn.Instance.Set(key, order);
-                RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
             }
+            db.Dispose();
             return order;
         }
         #endregion

+ 1 - 0
AppStart/Redis/Mysql/MerchantInfoDbconn.cs

@@ -17,6 +17,7 @@ namespace MySystem
             if (order != null)
             {
             }
+            db.Dispose();
             return order;
         }
         #endregion

+ 29 - 30
Areas/Api/Controllers/v1/MainServer/MerchantAddInfoController.cs

@@ -36,6 +36,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         public AppResultJson AddDo(string value)
         {
+            // value = "{\"AlipayAccount\": \"13308013195\",\"LicenseCopy\": \"/mptest/v2/2023/5/16/330549a279dc65e1.png\",\"CertMerchantName\": \"测试\",\"LicenseNumber\": \"12341674981561J\",\"BusinessTerm\": \"2023-05-18-2023-05-25\",\"SubjectType\": \"SUBJECT_TYPE_INDIVIDUAL\",\"MerchantShortname\": \"测试\",\"ServicePhone\": \"14781419364\",\"QualificationType\": \"食品生鲜,酒类\",\"SpecialQualification\": \"\",\"MerchantAuthorizationLetter\": \"\",\"BizStoreName\": \"测试门店\",\"BizAddressCode\": \"北京市,东城区\",\"BizStoreAddress\": \"天安门红旗下\",\"IdCardCopy\": \"/mptest/v2/2023/5/16/f1a84d2a06113b5d.png\",\"IdCardNational\": \"/mptest/v2/2023/5/16/f50795237dea60ef.png\",\"CertLegalPerson\": \"张晟源\",\"IdCardNumber\": \"51382219940929723\",\"CardPeriodBegin\": \"2023-05-16\",\"CardPeriodEnd\": \"2023-05-19\",\"MobilePhone\": \"13308013195\",\"ContactEmail\": \"13308013195\",\"AccountName\": \"张晟源\",\"BankAccountType\": \"BANK_ACCOUNT_TYPE_PERSONAL\",\"AccountNumber\": \"6135124587452145\",\"AccountBank\": \"工商银行\",\"BankName\": \"中原银行股份有限公司信阳工商支行\",\"BankAddressCode\": \"北京市,东城区\",\"StoreEntrancePic\": \"/mptest/v2/2023/5/16/ac601bd8da78f4c8.png,/mptest/v2/2023/5/16/61d7dabf9aec0589.png\",\"IndoorPic\": \"/mptest/v2/2023/5/16/d20c693f5c15293b.png,/mptest/v2/2023/5/16/bd365c9d677ee77c.png,/mptest/v2/2023/5/16/706a3b275b7ca186.png\",\"ContactName\": \"张晟源\",\"ContactIdNumber\": \"51382219940929723\",\"IdCardName\": \"张晟源\",\"Qualifications\": \"\",\"Finish\": 1,\"UserId\": \"14\",\"Id\": \"\",\"SettlementId\": \"719_C_C05_5921\"}";
             JsonData data = JsonMapper.ToObject(value);
             string ContactName = data["ContactName"].ToString(); //管理员姓名
             string ContactIdNumber = data["ContactIdNumber"].ToString(); //管理员身份证件号码
@@ -98,21 +99,16 @@ namespace MySystem.Areas.Api.Controllers.v1
                 }
                 BankBranchId = openBank.BankCode;
             }
-            MerchantForName checkMobile = maindb.MerchantForName.FirstOrDefault(m => m.Name == CertMerchantName);
-            if (checkMobile != null)
-            { 
-                return new AppResultJson() { Status = "-1", Info = "商户名称已存在,请勿重复提交" };
-            }
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MerchantAddInfo query = MerchantAddInfoDbconn.Instance.Get(MerchantAddInfoId);
-            if (query == null)
-            {
-                // MerchantAddInfoId = PublicFunction.MakeMerchantAddInfoId();
-                query = new MerchantAddInfo()
+            MerchantAddInfo query = maindb.MerchantAddInfo.FirstOrDefault(m => m.CertMerchantName == CertMerchantName);
+            if(query == null)
+            {                
+                query = maindb.MerchantAddInfo.Add(new MerchantAddInfo()
                 {
-                    Id = MerchantAddInfoId,
-                    CreateDate = DateTime.Now, //创建时间
-                };
+                    CreateDate = DateTime.Now,
+                    CertMerchantName = CertMerchantName,
+                }).Entity;
+                maindb.SaveChanges();
             }
             query.UpdateDate = DateTime.Now; //修改时间
             query.ContactName = ContactName; //管理员姓名
@@ -152,27 +148,30 @@ namespace MySystem.Areas.Api.Controllers.v1
             query.ActivitiesRate = "0.60";
             query.CreateMan = AlipayAccount;
             query.UpdateMan = AlipayMccCode;
-            MerchantInfo merchant = new MerchantInfo()
-            {
-                Id = MerchantAddInfoId,
-                CreateDate = DateTime.Now,
-                UpdateDate = DateTime.Now,
-                UserId = UserId, //创客
-                Name = CertMerchantName,
-                Mobile = MobilePhone,
-                Areas = BizAddressCode,
-                Address = BizStoreAddress,
-                QueryCount = 1,
-            };
+            MerchantInfo merchant = maindb.MerchantInfo.FirstOrDefault(m => m.Id == query.Id);
+            if(merchant == null)
+            {                
+                merchant = maindb.MerchantInfo.Add(new MerchantInfo()
+                {
+                    Id = query.Id,
+                    CreateDate = DateTime.Now,
+                }).Entity;
+                maindb.SaveChanges();
+            }
+            merchant.UpdateDate = DateTime.Now;
+            merchant.UserId = UserId; //创客
+            merchant.Name = CertMerchantName;
+            merchant.Mobile = MobilePhone;
+            merchant.Areas = BizAddressCode;
+            merchant.Address = BizStoreAddress;
+            merchant.QueryCount = 1;
             if (Finish == 1)
             {
-                // 如果提交完整资料,则发送到BsServer执行进件操作
-                RabbitMQClient.Instance.SendMsg(MerchantAddInfoId.ToString(), "MerchantConfirmList");
                 merchant.QueryCount = 0;
-                MerchantParamSet set = new MerchantParamSet();
-                set.Id = MerchantAddInfoId;
-                set.IsAll = 1;
+                // 如果提交完整资料,则发送到BsServer执行进件操作
+                RedisDbconn.Instance.AddList("MerchantConfirmQueue", merchant.Id.ToString());
             }
+            maindb.SaveChanges();
             Obj.Add("Id", MerchantAddInfoId); //Id
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
         }

+ 3 - 2
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -307,6 +307,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         public List<Dictionary<string, object>> MerchantByStatusDo(string value)
         {
+            // value = "{\"PageSize\":10,\"PageNum\":1,\"UserId\":\"13\",\"Status\":0,\"SearchKey\":\"\"}";
             JsonData data = JsonMapper.ToObject(value);
             string SearchKey = data["SearchKey"].ToString();
             int Status = int.Parse(function.CheckInt(data["Status"].ToString()));
@@ -448,11 +449,11 @@ namespace MySystem.Areas.Api.Controllers.v1
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
             int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            RabbitMQClient.Instance.SendMsg("MerchantInfo:" + Id.ToString(), "DeleteMySqlData");
             MerchantInfo edit = maindb.MerchantInfo.FirstOrDefault(m => m.Id == Id && m.UserId == UserId);
             if(edit != null)
             {
-                maindb.MerchantInfo.Remove(edit);
+                // maindb.MerchantInfo.Remove(edit);
+                edit.QueryCount = 0;
                 maindb.SaveChanges();
             }
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };