|
|
@@ -449,12 +449,13 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
AddSysLog(Id, "PosMachinesTwo", "UpFeePosMachinesTwo");
|
|
|
List<int> posIds = new List<int>();
|
|
|
+ List<int> upposIds = new List<int>();
|
|
|
string userIds = "";
|
|
|
- string warning = "";
|
|
|
- if (!string.IsNullOrEmpty(warning))
|
|
|
- {
|
|
|
- return "Warning |" + warning;
|
|
|
- }
|
|
|
+ // string warning = "";
|
|
|
+ // if (!string.IsNullOrEmpty(warning))
|
|
|
+ // {
|
|
|
+ // return "Warning |" + warning;
|
|
|
+ // }
|
|
|
foreach (string subids in idlist)
|
|
|
{
|
|
|
int id = int.Parse(subids);
|
|
|
@@ -464,13 +465,19 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
Fields.Add("UpFeeMan", SysUserName);
|
|
|
Fields.Add("UpFeeDate", DateTime.Now);
|
|
|
|
|
|
+ if (!userIds.Contains(pos.BuyUserId.ToString()))
|
|
|
+ {
|
|
|
+ userIds += pos.BuyUserId + ",";
|
|
|
+ }
|
|
|
+
|
|
|
if (pos.BrandId == 1 || pos.BrandId == 3 || pos.BrandId == 6)
|
|
|
{
|
|
|
- if (!userIds.Contains(pos.BuyUserId.ToString()))
|
|
|
- {
|
|
|
- userIds += pos.BuyUserId + ",";
|
|
|
- }
|
|
|
- posIds.Add(id);
|
|
|
+ // if (!userIds.Contains(pos.BuyUserId.ToString()))
|
|
|
+ // {
|
|
|
+ // userIds += pos.BuyUserId + ",";
|
|
|
+ // }
|
|
|
+ // posIds.Add(id);
|
|
|
+
|
|
|
|
|
|
// PosId:机具Id
|
|
|
// Kind:1或2,1为费率0.63,2为费率0.6
|
|
|
@@ -480,77 +487,11 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- warning += "以下机具调升失败 :" + pos.PosSn + '\n' + "目前只支持金控、立刷";
|
|
|
+ upposIds.Add(id);
|
|
|
+ // warning += "以下机具调升失败 :" + pos.PosSn + '\n' + "目前只支持金控、立刷";
|
|
|
}
|
|
|
new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, id);
|
|
|
- }
|
|
|
- db.SaveChanges();
|
|
|
- db.Dispose();
|
|
|
- return "success";
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
|
|
|
- #region 导入费率调整结果
|
|
|
- /// <summary>
|
|
|
- /// 导入费率调整结果
|
|
|
- /// </summary>
|
|
|
- /// <param name="ExcelData"></param>
|
|
|
- public string ImportEnd(string ExcelData)
|
|
|
- {
|
|
|
- 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 = "";
|
|
|
- for (int i = 1; i < list.Count; i++)
|
|
|
- {
|
|
|
- JsonData dr = list[i];
|
|
|
- string PosNo = dr[0].ToString(); // 机具Sn
|
|
|
- decimal Amount = decimal.Parse(dr[1].ToString()); // 调整费率
|
|
|
- int Kind = int.Parse(dr[2].ToString()); // 1 调升 2 调低
|
|
|
- var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosNo) ?? new PosMachinesTwo();
|
|
|
- if (pos.BrandId == 1 || pos.BrandId == 3 || pos.BrandId == 6)
|
|
|
- {
|
|
|
- warning += PosNo + ",该机具应直接设置,请全部重新导入";
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(warning))
|
|
|
- {
|
|
|
- return "waning |" + warning;
|
|
|
- }
|
|
|
- }
|
|
|
- for (int i = 1; i < list.Count; i++)
|
|
|
- {
|
|
|
- JsonData dr = list[i];
|
|
|
- string PosNo = dr[0].ToString(); // 机具Sn
|
|
|
- decimal Amount = decimal.Parse(dr[1].ToString()); // 调整费率
|
|
|
- int Kind = int.Parse(dr[2].ToString()); // 1 调升 2 调低
|
|
|
- var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosNo) ?? new PosMachinesTwo();
|
|
|
- if (Kind == 1)
|
|
|
- {
|
|
|
- pos.UpFeeFlag = 1;
|
|
|
- pos.UpFeeDate = DateTime.Now;
|
|
|
- pos.UpFeeMan = SysUserName + "_" + SysRealName;
|
|
|
- db.SaveChanges();
|
|
|
- upposIds.Add(pos.Id);
|
|
|
-
|
|
|
- }
|
|
|
- if (Kind == 2)
|
|
|
- {
|
|
|
- pos.DownFeeFlag = 1;
|
|
|
- pos.DownFeeDate = DateTime.Now;
|
|
|
- pos.DownFeeMan = SysUserName + "_" + SysRealName;
|
|
|
- db.SaveChanges();
|
|
|
- dnposIds.Add(pos.Id);
|
|
|
-
|
|
|
- }
|
|
|
- if (!userIds.Contains(pos.BuyUserId.ToString()))
|
|
|
- {
|
|
|
- userIds += pos.BuyUserId + ",";
|
|
|
- }
|
|
|
}
|
|
|
string[] lists = userIds.TrimEnd(',').Split(new char[] { ',' });
|
|
|
int times = lists.ToList().Count;
|
|
|
@@ -594,6 +535,111 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}));
|
|
|
}
|
|
|
}
|
|
|
+ db.SaveChanges();
|
|
|
+ db.Dispose();
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 导入费率调整结果
|
|
|
+ /// <summary>
|
|
|
+ /// 导入费率调整结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="ExcelData"></param>
|
|
|
+ public string ImportEnd(string ExcelData)
|
|
|
+ {
|
|
|
+ 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 = "";
|
|
|
+
|
|
|
+ for (int i = 1; i < list.Count; i++)
|
|
|
+ {
|
|
|
+ JsonData dr = list[i];
|
|
|
+ string PosNo = dr[0].ToString(); // 机具Sn
|
|
|
+ var Amount = double.Parse(dr[1].ToString()); // 调整费率
|
|
|
+ int Kind = int.Parse(dr[2].ToString()); // 1 调升 2 调低
|
|
|
+ var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosNo) ?? new PosMachinesTwo();
|
|
|
+ if (pos.UpFeeFlag == 1)
|
|
|
+ {
|
|
|
+ if (Kind != 2 || Amount != 0.6)
|
|
|
+ {
|
|
|
+ warning += PosNo + ",该机具调低费率数值或类型不正确,请检查好后全部重新导入";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (Kind == 2 && Amount == 0.6)
|
|
|
+ {
|
|
|
+ pos.DownFeeFlag = 1;
|
|
|
+ pos.DownFeeDate = DateTime.Now;
|
|
|
+ pos.DownFeeMan = SysUserName + "_" + SysRealName;
|
|
|
+ db.SaveChanges();
|
|
|
+ dnposIds.Add(pos.Id);
|
|
|
+
|
|
|
+ }
|
|
|
+ if (!userIds.Contains(pos.BuyUserId.ToString()))
|
|
|
+ {
|
|
|
+ userIds += pos.BuyUserId + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ warning += PosNo + ",该机具不符合调低条件,请检查好后全部重新导入";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(warning))
|
|
|
+ {
|
|
|
+ return "waning |" + warning;
|
|
|
+ }
|
|
|
+ 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)
|
|
|
{
|
|
|
//调降
|
|
|
@@ -753,7 +799,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
|
|
|
|
|
|
- Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesTwo", Fields, "Id desc", "0", 1, 20000, condition, "BindingState,ActivationState,UserId,StoreId,PosSn,BrandId,ActivityList,BindMerchantId,PosSnType,DeviceType,BindingTime,ActivationTime,TransferTime", false);
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesTwo", Fields, "Id desc", "0", 1, 20000, condition, "BindingState,ActivationState,UserId,StoreId,PosSn,BrandId,ActivityList,BindMerchantId,PosSnType,DeviceType,BindingTime,UpFeeDate,DownFeeDate,ActivationTime,TransferTime", false);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|