|
@@ -59,14 +59,10 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
Fields.Add("CreateDate", "3"); //时间
|
|
Fields.Add("CreateDate", "3"); //时间
|
|
|
Fields.Add("PosSn", "1"); //机具SN
|
|
Fields.Add("PosSn", "1"); //机具SN
|
|
|
Fields.Add("MerNo", "1"); //商户号
|
|
Fields.Add("MerNo", "1"); //商户号
|
|
|
- Fields.Add("Sort", "0"); //
|
|
|
|
|
|
|
+ Fields.Add("Sort", "0"); //品牌
|
|
|
|
|
|
|
|
|
|
|
|
|
string condition = " and Status>=-1";
|
|
string condition = " and Status>=-1";
|
|
|
- if (!string.IsNullOrEmpty(StatusSelect))
|
|
|
|
|
- {
|
|
|
|
|
- condition += " and Status=" + StatusSelect;
|
|
|
|
|
- }
|
|
|
|
|
//创客创客编号
|
|
//创客创客编号
|
|
|
if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
|
{
|
|
{
|
|
@@ -87,6 +83,21 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
{
|
|
|
condition += " and PosUserId in (select PosUserId from UsersForRealName where RealName='" + PosUserIdRealName + "')";
|
|
condition += " and PosUserId in (select PosUserId from UsersForRealName where RealName='" + PosUserIdRealName + "')";
|
|
|
}
|
|
}
|
|
|
|
|
+ //品牌
|
|
|
|
|
+ if (data.Sort == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ condition += " and Sort = 1";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data.Sort != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ condition += " and Sort = " + data.Sort;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data.Status > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(data.Status == 2) data.Status = 0;
|
|
|
|
|
+ if(data.Status == 3) data.Status = -1;
|
|
|
|
|
+ condition += " and Status = " + data.Status;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesFeeChangeRecord", Fields, "Id desc", "0", page, limit, condition);
|
|
Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesFeeChangeRecord", Fields, "Id desc", "0", page, limit, condition);
|
|
@@ -297,6 +308,113 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
}
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ #region 导入费率调整结果
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 导入费率调整结果
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="ExcelData"></param>
|
|
|
|
|
+ public string ImportEnd(string ExcelData)
|
|
|
|
|
+ {
|
|
|
|
|
+ ExcelData = HttpUtility.UrlDecode(ExcelData);
|
|
|
|
|
+ JsonData list = JsonMapper.ToObject(ExcelData);
|
|
|
|
|
+
|
|
|
|
|
+ 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;
|
|
|
|
|
+ var poschange = db.PosMachinesFeeChangeRecord.FirstOrDefault(m => m.PosId == pos.Id);
|
|
|
|
|
+ poschange.Status = 1;
|
|
|
|
|
+ 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 (dnposIds.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ //调降
|
|
|
|
|
+ for (int i = 0; i < times; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ var UserId = lists[i];
|
|
|
|
|
+ var posInfo = db.PosMachinesTwo.Where(m => dnposIds.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>";
|
|
|
|
|
+ snhtml += "<div class='f16'>当前费率:0.6%</div>";
|
|
|
|
|
+ snhtml += "<div class='f16'>费率调整时间:" + items.DownFeeDate + "</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'>您的商户刷卡交易费率已变更成功!</div>" + snhtml, //内容
|
|
|
|
|
+ Summary = "您的商户刷卡交易费率已变更成功!",
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
+
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ AddSysLog("0", "PosMachinesTwoChange", "ImportEnd");
|
|
|
|
|
+ return "success";
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#region 导入数据
|
|
#region 导入数据
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 导入数据
|
|
/// 导入数据
|
|
@@ -335,9 +453,10 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
Fields.Add("CreateDate", "3"); //时间
|
|
Fields.Add("CreateDate", "3"); //时间
|
|
|
Fields.Add("PosSn", "1"); //机具SN
|
|
Fields.Add("PosSn", "1"); //机具SN
|
|
|
Fields.Add("MerNo", "1"); //商户号
|
|
Fields.Add("MerNo", "1"); //商户号
|
|
|
|
|
+ Fields.Add("Sort", "0"); //品牌
|
|
|
|
|
|
|
|
|
|
|
|
|
- string condition = " and Status>-1";
|
|
|
|
|
|
|
+ string condition = " and Status>-1 and Sort = " + data.Sort + "";
|
|
|
//创客创客编号
|
|
//创客创客编号
|
|
|
if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
|
{
|
|
{
|
|
@@ -358,24 +477,33 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
{
|
|
|
condition += " and PosUserId in (select PosUserId from UsersForRealName where RealName='" + PosUserIdRealName + "')";
|
|
condition += " and PosUserId in (select PosUserId from UsersForRealName where RealName='" + PosUserIdRealName + "')";
|
|
|
}
|
|
}
|
|
|
|
|
+ if (data.Status > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(data.Status == 2) data.Status = 0;
|
|
|
|
|
+ if(data.Status == 3) data.Status = -1;
|
|
|
|
|
+ condition += " and Status = " + data.Status;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesFeeChangeRecord", Fields, "Id desc", "0", 1, 20000, condition, "UserId,ChangeFee,PosSn,MerNo,PosUserId", false);
|
|
|
|
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesFeeChangeRecord", Fields, "Id desc", "0", 1, 20000, condition, "PosSn,ChangeFee", false);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|
|
{
|
|
|
- //创客
|
|
|
|
|
- int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
|
|
|
|
|
- Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
|
|
- dic["UserIdMakerCode"] = userid_Users.MakerCode;
|
|
|
|
|
- dic["UserIdRealName"] = userid_Users.RealName;
|
|
|
|
|
- dic.Remove("UserId");
|
|
|
|
|
- //机具所属人
|
|
|
|
|
- int PosUserId = int.Parse(function.CheckInt(dic["PosUserId"].ToString()));
|
|
|
|
|
- Users posuserid_Users = db.Users.FirstOrDefault(m => m.Id == PosUserId) ?? new Users();
|
|
|
|
|
- dic["PosUserIdMakerCode"] = posuserid_Users.MakerCode;
|
|
|
|
|
- dic["PosUserIdRealName"] = posuserid_Users.RealName;
|
|
|
|
|
- dic.Remove("PosUserId");
|
|
|
|
|
|
|
+ // //创客
|
|
|
|
|
+ // int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
|
|
|
|
|
+ // Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
|
|
+ // dic["UserIdMakerCode"] = userid_Users.MakerCode;
|
|
|
|
|
+ // dic["UserIdRealName"] = userid_Users.RealName;
|
|
|
|
|
+ // dic.Remove("UserId");
|
|
|
|
|
+ // //机具所属人
|
|
|
|
|
+ // int PosUserId = int.Parse(function.CheckInt(dic["PosUserId"].ToString()));
|
|
|
|
|
+ // Users posuserid_Users = db.Users.FirstOrDefault(m => m.Id == PosUserId) ?? new Users();
|
|
|
|
|
+ // dic["PosUserIdMakerCode"] = posuserid_Users.MakerCode;
|
|
|
|
|
+ // dic["PosUserIdRealName"] = posuserid_Users.RealName;
|
|
|
|
|
+ // dic.Remove("PosUserId");
|
|
|
|
|
+
|
|
|
|
|
+ var PosSn = dic["PosSn"].ToString();
|
|
|
|
|
+ var ChangeFee = function.CheckNum(dic["ChangeFee"].ToString());
|
|
|
|
|
+ dic.Add("Kind", "2");
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -384,13 +512,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
|
|
result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
|
|
|
result.Add("Obj", diclist);
|
|
result.Add("Obj", diclist);
|
|
|
Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
|
|
Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
|
|
|
- ReturnFields.Add("UserIdMakerCode", "创客创客编号");
|
|
|
|
|
- ReturnFields.Add("UserIdRealName", "创客真实姓名");
|
|
|
|
|
- ReturnFields.Add("ChangeFee", "调整费率");
|
|
|
|
|
|
|
+ // ReturnFields.Add("UserIdMakerCode", "创客创客编号");
|
|
|
|
|
+ // ReturnFields.Add("UserIdRealName", "创客真实姓名");
|
|
|
|
|
+ // ReturnFields.Add("ChangeFee", "调整费率");
|
|
|
ReturnFields.Add("PosSn", "机具SN");
|
|
ReturnFields.Add("PosSn", "机具SN");
|
|
|
- ReturnFields.Add("MerNo", "商户号");
|
|
|
|
|
- ReturnFields.Add("PosUserIdMakerCode", "机具所属人创客编号");
|
|
|
|
|
- ReturnFields.Add("PosUserIdRealName", "机具所属人真实姓名");
|
|
|
|
|
|
|
+ ReturnFields.Add("ChangeFee", "调整费率");
|
|
|
|
|
+ ReturnFields.Add("Kind", "调整类型(2-调降)");
|
|
|
|
|
|
|
|
result.Add("Fields", ReturnFields);
|
|
result.Add("Fields", ReturnFields);
|
|
|
AddSysLog("0", "PosMachinesFeeChangeRecord", "ExportExcel");
|
|
AddSysLog("0", "PosMachinesFeeChangeRecord", "ExportExcel");
|