Kaynağa Gözat

一键调升费率分离(有无接口,直接修改标记)

DuGuYang 3 yıl önce
ebeveyn
işleme
26cef99deb

+ 82 - 54
Areas/Admin/Controllers/MainServer/PosMachinesTwoChangeController.cs

@@ -91,7 +91,7 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreIdName + "')";
             }
             //品牌
-            condition += " and BrandId = " + data.BrandId;
+            // condition += " and BrandId = " + data.BrandId;
             if (!string.IsNullOrEmpty(UpFeeFlagSelect))
             {
                 condition += " and UpFeeFlag = " + UpFeeFlagSelect;
@@ -451,11 +451,6 @@ namespace MySystem.Areas.Admin.Controllers
             List<int> posIds = new List<int>();
             List<int> upposIds = new List<int>();
             string userIds = "";
-            // string warning = "";
-            // if (!string.IsNullOrEmpty(warning))
-            // {
-            //     return "Warning |" + warning;
-            // }
             foreach (string subids in idlist)
             {
                 int id = int.Parse(subids);
@@ -472,23 +467,17 @@ namespace MySystem.Areas.Admin.Controllers
 
                 if (pos.BrandId == 1 || pos.BrandId == 3 || pos.BrandId == 6)
                 {
-                    // if (!userIds.Contains(pos.BuyUserId.ToString()))
-                    // {
-                    //     userIds += pos.BuyUserId + ",";
-                    // }
-                    // posIds.Add(id);
 
 
                     // PosId:机具Id
                     // Kind:1或2,1为费率0.63,2为费率0.6
                     // OpMan:操作人,app传创客编号,后台传SysUserName
-                    string info = "{\"RecordId\":\"" + query.Id + "\",\"PosId\":" + id + "\"\",\"Fee\": " + 0.63 + "\"\",\"Kind\": " + 1 + "\"\",\"OpMan\": " + SysUserName + "\"\"}";
+                    string info = "{\"RecordId\":\"\",\"PosId\":" + id + "\"\",\"Fee\": " + 0.63 + "\"\",\"Kind\": " + 1 + "\"\",\"OpMan\": " + SysUserName + "\"\"}";
                     RedisDbconn.Instance.AddList("SetDepositQueue", info);
                 }
                 else
                 {
                     upposIds.Add(id);
-                    // warning += "以下机具调升失败 :" + pos.PosSn + '\n' + "目前只支持金控、立刷";
                 }
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, id);
 
@@ -543,6 +532,86 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        // #region 批量调升费率(无接口限制)
+
+        // /// <summary>
+        // /// 批量调升费率
+        // /// </summary>
+        // /// <returns></returns>
+        // public string BatchSetting(string Id)
+        // {
+        //     string[] idlist = Id.Split(new char[] { ',' });
+        //     AddSysLog(Id, "PosMachinesTwo", "UpFeePosMachinesTwo");
+        //     List<int> posIds = new List<int>();
+        //     List<int> upposIds = new List<int>();
+        //     string userIds = "";
+        //     foreach (string subids in idlist)
+        //     {
+        //         int id = int.Parse(subids);
+        //         var pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == id) ?? new PosMachinesTwo();
+        //         Dictionary<string, object> Fields = new Dictionary<string, object>();
+        //         Fields.Add("UpFeeFlag", 1);
+        //         Fields.Add("UpFeeMan", SysUserName);
+        //         Fields.Add("UpFeeDate", DateTime.Now);
+
+        //         if (!userIds.Contains(pos.BuyUserId.ToString()))
+        //         {
+        //             userIds += pos.BuyUserId + ",";
+        //         }
+        //         upposIds.Add(id);
+        //         new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, id);
+
+        //     }
+        //     string[] lists = userIds.TrimEnd(',').Split(new char[] { ',' });
+        //     int times = lists.ToList().Count;
+        //     if (upposIds.Count > 0)
+        //     {
+        //         //调升
+        //         for (int i = 0; i < times; i++)
+        //         {
+        //             var UserId = lists[i];
+        //             var posInfo = db.PosMachinesTwo.Where(m => upposIds.Contains(m.Id) && m.BuyUserId == Convert.ToInt32(UserId)).ToList();
+        //             string snhtml = "<div style='margin-bottom: .48rem;'>";
+        //             foreach (var items in posInfo)
+        //             {
+        //                 var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == items.BindMerchantId);
+        //                 string Name = mer.MerchantName;
+        //                 if (mer.BrandId == 2)
+        //                 {
+        //                     if (Name.Contains("-"))
+        //                     {
+        //                         Name = Name.Split('-')[1];
+        //                     }
+        //                     else if (Name.Contains("_"))
+        //                     {
+        //                         Name = Name.Split('_')[1];
+        //                     }
+        //                 }
+        //                 var brand = db.KqProducts.FirstOrDefault(m => m.Id == items.BrandId);
+        //                 snhtml += "<div style='margin-bottom: .48rem;'><div class='f16'>商户姓名:" + Name + "</div>";
+        //                 snhtml += "<div class='f16'>机具品牌:" + brand.Name + "</div>";
+        //                 snhtml += "<div class='f16'>SN:" + items.PosSn + "</div></div>";
+        //             }
+        //             snhtml += "</div>";
+        //             RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+        //             {
+        //                 UserId = Convert.ToInt32(UserId), //创客
+        //                 Title = "商户费率变更通知", //标题
+        //                 Content = "<div class='f16' style='margin-bottom: .72rem'>您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率</div>" + snhtml, //内容
+        //                 Summary = "您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率",
+        //                 CreateDate = DateTime.Now,
+
+        //             }));
+        //         }
+        //     }
+        //     db.SaveChanges();
+        //     db.Dispose();
+        //     return "success";
+        // }
+
+        // #endregion
+
+
         #region 导入费率调整结果
         /// <summary>
         /// 导入费率调整结果
@@ -553,7 +622,6 @@ namespace MySystem.Areas.Admin.Controllers
             ExcelData = HttpUtility.UrlDecode(ExcelData);
             JsonData list = JsonMapper.ToObject(ExcelData);
 
-            // List<int> upposIds = new List<int>();
             List<int> dnposIds = new List<int>();
             string userIds = "";
             string warning = "";
@@ -602,46 +670,6 @@ namespace MySystem.Areas.Admin.Controllers
             }
             string[] lists = userIds.TrimEnd(',').Split(new char[] { ',' });
             int times = lists.ToList().Count;
-            // if (upposIds.Count > 0)
-            // {
-            //     //调升
-            //     for (int i = 0; i < times; i++)
-            //     {
-            //         var UserId = lists[i];
-            //         var posInfo = db.PosMachinesTwo.Where(m => upposIds.Contains(m.Id) && m.BuyUserId == Convert.ToInt32(UserId)).ToList();
-            //         string snhtml = "<div style='margin-bottom: .48rem;'>";
-            //         foreach (var items in posInfo)
-            //         {
-            //             var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == items.BindMerchantId);
-            //             string Name = mer.MerchantName;
-            //             if (mer.BrandId == 2)
-            //             {
-            //                 if (Name.Contains("-"))
-            //                 {
-            //                     Name = Name.Split('-')[1];
-            //                 }
-            //                 else if (Name.Contains("_"))
-            //                 {
-            //                     Name = Name.Split('_')[1];
-            //                 }
-            //             }
-            //             var brand = db.KqProducts.FirstOrDefault(m => m.Id == items.BrandId);
-            //             snhtml += "<div style='margin-bottom: .48rem;'><div class='f16'>商户姓名:" + Name + "</div>";
-            //             snhtml += "<div class='f16'>机具品牌:" + brand.Name + "</div>";
-            //             snhtml += "<div class='f16'>SN:" + items.PosSn + "</div></div>";
-            //         }
-            //         snhtml += "</div>";
-            //         RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-            //         {
-            //             UserId = Convert.ToInt32(UserId), //创客
-            //             Title = "商户费率变更通知", //标题
-            //             Content = "<div class='f16' style='margin-bottom: .72rem'>您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率</div>" + snhtml, //内容
-            //             Summary = "您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率",
-            //             CreateDate = DateTime.Now,
-
-            //         }));
-            //     }
-            // }
             if (dnposIds.Count > 0)
             {
                 //调降