|
@@ -46,9 +46,11 @@ namespace MySystem
|
|
|
{
|
|
|
ids.Add(int.Parse(sub));
|
|
|
}
|
|
|
+ List<KqProducts> brands = db.KqProducts.ToList();
|
|
|
List<PosMachinesTwo> poslist = db.PosMachinesTwo.Where(m => ids.Contains(m.Id)).ToList();
|
|
|
List<int> mids = poslist.Select(m => m.BindMerchantId).ToList();
|
|
|
List<PosMerchantInfo> merchantlist = db.PosMerchantInfo.Where(m => mids.Contains(m.Id)).ToList();
|
|
|
+ Dictionary<int, List<PosMachinesTwo>> userPosList = new Dictionary<int, List<PosMachinesTwo>>();
|
|
|
foreach(PosMachinesTwo pos in poslist)
|
|
|
{
|
|
|
PosMerchantInfo merchant = merchantlist.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
@@ -78,6 +80,17 @@ namespace MySystem
|
|
|
pos.DownFeeDate = DateTime.Now;
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
+ pos.QueryCount = Kind;
|
|
|
+ if(userPosList.ContainsKey(pos.BuyUserId))
|
|
|
+ {
|
|
|
+ userPosList[pos.BuyUserId].Add(pos);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<PosMachinesTwo> subPos = new List<PosMachinesTwo>();
|
|
|
+ subPos.Add(pos);
|
|
|
+ userPosList.Add(pos.BuyUserId, subPos);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -111,6 +124,18 @@ namespace MySystem
|
|
|
pos.DownFeeMan = OpMan;
|
|
|
pos.DownFeeDate = DateTime.Now;
|
|
|
}
|
|
|
+ db.SaveChanges();
|
|
|
+ pos.QueryCount = Kind;
|
|
|
+ if(userPosList.ContainsKey(pos.BuyUserId))
|
|
|
+ {
|
|
|
+ userPosList[pos.BuyUserId].Add(pos);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<PosMachinesTwo> subPos = new List<PosMachinesTwo>();
|
|
|
+ subPos.Add(pos);
|
|
|
+ userPosList.Add(pos.BuyUserId, subPos);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -121,6 +146,55 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ foreach(int UserId in userPosList.Keys)
|
|
|
+ {
|
|
|
+ string snhtml = "", snhtml2 = "";
|
|
|
+ foreach (var items in userPosList[UserId])
|
|
|
+ {
|
|
|
+ var mer = merchantlist.FirstOrDefault(m => m.Id == items.BindMerchantId) ?? new PosMerchantInfo();
|
|
|
+ var brand = brands.FirstOrDefault(m => m.Id == items.BrandId) ?? new KqProducts();
|
|
|
+ if(items.QueryCount == 1)
|
|
|
+ {
|
|
|
+ snhtml += "<div style='margin-bottom: .48rem;'><div class='f12'>商户姓名:" + mer.MerRealName + "</div>";
|
|
|
+ snhtml += "<div class='f12'>机具品牌:" + brand.Name + "</div>";
|
|
|
+ snhtml += "<div class='f12'>SN:" + items.PosSn + "</div>";
|
|
|
+ string DownFeeDate = items.DownFeeDate == null ? "" : items.DownFeeDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ }
|
|
|
+ else if(items.QueryCount == 2)
|
|
|
+ {
|
|
|
+ snhtml2 += "<div style='margin-bottom: .48rem;'><div class='f12'>商户姓名:" + mer.MerRealName + "</div>";
|
|
|
+ snhtml2 += "<div class='f12'>机具品牌:" + brand.Name + "</div>";
|
|
|
+ snhtml2 += "<div class='f12'>SN:" + items.PosSn + "</div>";
|
|
|
+ string DownFeeDate = items.DownFeeDate == null ? "" : items.DownFeeDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ snhtml2 += "<div class='f12'>当前费率:0.6%</div>";
|
|
|
+ snhtml2 += "<div class='f12'>费率调整时间:" + DownFeeDate + "</div>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!string.IsNullOrEmpty(snhtml))
|
|
|
+ {
|
|
|
+ snhtml = "<div style='margin-bottom: .48rem;'>" + snhtml + "</div>";
|
|
|
+ RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
+ {
|
|
|
+ UserId = Convert.ToInt32(UserId), //创客
|
|
|
+ Title = "商户费率变更通知", //标题
|
|
|
+ Content = "<div class='f12' style='margin-bottom: .72rem'>您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率</div>" + snhtml, //内容
|
|
|
+ Summary = "您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率",
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(snhtml2))
|
|
|
+ {
|
|
|
+ snhtml2 = "<div style='margin-bottom: .48rem;'>" + snhtml2 + "</div>";
|
|
|
+ RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
+ {
|
|
|
+ UserId = Convert.ToInt32(UserId), //创客
|
|
|
+ Title = "商户费率变更通知", //标题
|
|
|
+ Content = "<div class='f12' style='margin-bottom: .72rem'>您的商户刷卡交易费率已变更成功!</div>" + snhtml2, //内容
|
|
|
+ Summary = "您的商户刷卡交易费率已变更成功!",
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
db.Dispose();
|
|
|
}
|