|
|
@@ -58,14 +58,13 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 创客列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public JsonResult IndexData(Users data, string ParentMakerCode, string ParentRealName, string AuthFlagSelect, int TopUserId, string RiskFlagSelect, string MerchantTypeSelect, int SelfId = 0, int ParentId = 0, int page = 1, int limit = 30)
|
|
|
+ public JsonResult IndexData(Users data, string ParentMakerCode, string ParentRealName, string AuthFlagSelect, string CreateDateData, int TopUserId, string RiskFlagSelect, string MerchantTypeSelect, int? sSettleAmount, int? eSettleAmount, int? sCashFreezeAmt, int? eCashFreezeAmt, int UserId, int SelfId = 0, int ParentId = 0, int page = 1, int limit = 30)
|
|
|
{
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
Fields.Add("MakerCode", "1"); //创客编号
|
|
|
Fields.Add("RealName", "1"); //创客名称
|
|
|
Fields.Add("Mobile", "1"); //手机号
|
|
|
Fields.Add("CertId", "1"); //身份证号码
|
|
|
- Fields.Add("CreateDate", "3"); //注册时间
|
|
|
Fields.Add("SettleAmount", "3"); //结算金额
|
|
|
Fields.Add("CashFreezeAmt", "3"); //冻结金额
|
|
|
Fields.Add("UserLevel", "0"); //创客等级
|
|
|
@@ -75,33 +74,49 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
//直属创客编号
|
|
|
if (!string.IsNullOrEmpty(ParentMakerCode))
|
|
|
{
|
|
|
- condition += " and Id in (select UserId from UserForMakerCode where MakerCode='" + ParentMakerCode + "')";
|
|
|
+ condition += " and ParentUserId in (select UserId from UserForMakerCode where MakerCode='" + ParentMakerCode + "')";
|
|
|
}
|
|
|
//直属创客名称
|
|
|
if (!string.IsNullOrEmpty(ParentRealName))
|
|
|
{
|
|
|
- condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
|
|
|
+ condition += " and ParentUserId in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
|
|
|
}
|
|
|
//实名状态
|
|
|
- if(!string.IsNullOrEmpty(AuthFlagSelect))
|
|
|
+ if (!string.IsNullOrEmpty(AuthFlagSelect))
|
|
|
{
|
|
|
condition += " and AuthFlag=" + AuthFlagSelect;
|
|
|
}
|
|
|
//顶级创客
|
|
|
- if(TopUserId > 0)
|
|
|
+ if (TopUserId > 0)
|
|
|
{
|
|
|
condition += " and ParentNav like '," + TopUserId + ",%'";
|
|
|
}
|
|
|
//风控标识
|
|
|
- if(!string.IsNullOrEmpty(RiskFlagSelect))
|
|
|
+ if (!string.IsNullOrEmpty(RiskFlagSelect))
|
|
|
{
|
|
|
condition += " and RiskFlag=" + RiskFlagSelect;
|
|
|
}
|
|
|
//商户创客类型
|
|
|
- if(!string.IsNullOrEmpty(MerchantTypeSelect))
|
|
|
+ if (!string.IsNullOrEmpty(MerchantTypeSelect))
|
|
|
{
|
|
|
condition += " and MerchantType=" + MerchantTypeSelect;
|
|
|
}
|
|
|
+ if (sSettleAmount != null)
|
|
|
+ {
|
|
|
+ condition += " and SettleAmount>=" + sSettleAmount.Value;
|
|
|
+ }
|
|
|
+ if (eSettleAmount != null)
|
|
|
+ {
|
|
|
+ condition += " and SettleAmount<=" + eSettleAmount.Value;
|
|
|
+ }
|
|
|
+ if (sCashFreezeAmt != null)
|
|
|
+ {
|
|
|
+ condition += " and CashFreezeAmt>=" + sCashFreezeAmt.Value;
|
|
|
+ }
|
|
|
+ if (eCashFreezeAmt != null)
|
|
|
+ {
|
|
|
+ condition += " and CashFreezeAmt<=" + eCashFreezeAmt.Value;
|
|
|
+ }
|
|
|
if (SelfId > 0)
|
|
|
{
|
|
|
Users self = db.Users.FirstOrDefault(m => m.Id == SelfId);
|
|
|
@@ -113,9 +128,20 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
}
|
|
|
if (ParentId > 0)
|
|
|
- {
|
|
|
+ {
|
|
|
condition += " and ParentUserId=" + ParentId;
|
|
|
}
|
|
|
+ if (UserId > 0)
|
|
|
+ {
|
|
|
+ condition += " and Id=" + UserId;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(CreateDateData))
|
|
|
+ {
|
|
|
+ string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
+ string start = datelist[0];
|
|
|
+ string end = datelist[1];
|
|
|
+ condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
|
|
|
+ }
|
|
|
|
|
|
Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, sort, "True", page, limit, condition);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
@@ -241,7 +267,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
Users editData = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
|
|
|
ViewBag.data = editData;
|
|
|
-
|
|
|
+
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
@@ -271,7 +297,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
+
|
|
|
#region 修改结算金额
|
|
|
|
|
|
public IActionResult EditSettleAmount(string right, int Id = 0)
|
|
|
@@ -279,7 +305,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
Users editData = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
|
|
|
- ViewBag.data = editData;
|
|
|
+ ViewBag.data = editData;
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
@@ -337,24 +363,36 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
int ChangeType = 0;
|
|
|
- if (Kind == 1)
|
|
|
+ if (Kind == 1 && data.CashFreezeAmt <= account.BalanceAmount)
|
|
|
{
|
|
|
account.BalanceAmount -= data.CashFreezeAmt;
|
|
|
account.FreezeAmount += data.CashFreezeAmt;
|
|
|
ChangeType = 61;
|
|
|
}
|
|
|
- else if (Kind == 2)
|
|
|
+ else if (Kind == 1 && data.CashFreezeAmt > account.BalanceAmount)
|
|
|
+ {
|
|
|
+ return "冻结金额大于余额";
|
|
|
+ }
|
|
|
+ else if (Kind == 2 && data.CashFreezeAmt <= account.FreezeAmount)
|
|
|
{
|
|
|
account.BalanceAmount += data.CashFreezeAmt;
|
|
|
account.FreezeAmount -= data.CashFreezeAmt;
|
|
|
ChangeType = 62;
|
|
|
}
|
|
|
- else if (Kind == 3)
|
|
|
+ else if (Kind == 2 && data.CashFreezeAmt > account.FreezeAmount)
|
|
|
+ {
|
|
|
+ return "解冻金额大于冻结金额";
|
|
|
+ }
|
|
|
+ else if (Kind == 3 && data.CashFreezeAmt <= account.BalanceAmount)
|
|
|
{
|
|
|
account.TotalAmount -= data.CashFreezeAmt;
|
|
|
account.BalanceAmount -= data.CashFreezeAmt;
|
|
|
ChangeType = 63;
|
|
|
}
|
|
|
+ else if (Kind == 3 && data.CashFreezeAmt > account.BalanceAmount)
|
|
|
+ {
|
|
|
+ return "扣减金额大于余额";
|
|
|
+ }
|
|
|
else if (Kind == 4)
|
|
|
{
|
|
|
account.TotalAmount += data.CashFreezeAmt;
|
|
|
@@ -426,7 +464,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
+
|
|
|
#region 详情
|
|
|
|
|
|
public IActionResult Detail(string right, int Id = 0)
|
|
|
@@ -451,7 +489,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
+
|
|
|
#region 三/四要素验证
|
|
|
|
|
|
public IActionResult ThreeElement(string right)
|
|
|
@@ -468,7 +506,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
[HttpPost]
|
|
|
public string ThreeElement(string Name, string CertId, string CardNo, string Mobile)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -498,6 +536,75 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+ #region 注销
|
|
|
+ // 1、未实名创客;
|
|
|
+ // 2、已实名创客,无开通商户;
|
|
|
+ // 3、近7天未在商城下单过商品;
|
|
|
+ // 4、名下无未绑定机具、机具券,无未申请的循环机;
|
|
|
+ public string Cancel(string UserId)
|
|
|
+ {
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == Convert.ToInt32(UserId));
|
|
|
+ if (user != null)
|
|
|
+ {
|
|
|
+ if (user.AuthFlag == 1)
|
|
|
+ {
|
|
|
+ bool check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.BindingState == 1);
|
|
|
+ if (check)
|
|
|
+ {
|
|
|
+ // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:已实名创客,无开通商户。如有疑问,请联系客服" });
|
|
|
+ return "注销失败,未满足条件:已实名创客,无开通商户。如有疑问,请联系客服";
|
|
|
+ }
|
|
|
+ DateTime checkDate = DateTime.Now.AddDays(-7);
|
|
|
+ check = db.Orders.Any(m => m.CreateDate >= checkDate && m.Status > 0 && m.UserId == user.Id);
|
|
|
+ if (check)
|
|
|
+ {
|
|
|
+ // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:近7天未在商城下单过商品。如有疑问,请联系客服" });
|
|
|
+ return "注销失败,未满足条件:近7天未在商城下单过商品。如有疑问,请联系客服";
|
|
|
+ }
|
|
|
+ check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.IsPurchase == 0);
|
|
|
+ if (check)
|
|
|
+ {
|
|
|
+ // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服" });
|
|
|
+ return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
|
|
|
+ }
|
|
|
+ check = db.PosCoupons.Any(m => m.UserId == user.Id && m.IsUse == 0);
|
|
|
+ if (check)
|
|
|
+ {
|
|
|
+ // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服" });
|
|
|
+ return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
|
|
|
+ }
|
|
|
+ UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
|
|
|
+ if (forMobile != null)
|
|
|
+ {
|
|
|
+ db.Remove(forMobile);
|
|
|
+ }
|
|
|
+ user.Status = -1;
|
|
|
+ user.Mobile += "d";
|
|
|
+ user.CertId += "d";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
|
|
|
+ if (forMobile != null)
|
|
|
+ {
|
|
|
+ db.Remove(forMobile);
|
|
|
+ }
|
|
|
+ user.Status = -1;
|
|
|
+ user.Mobile += "d";
|
|
|
+ user.CertId += "d";
|
|
|
+ }
|
|
|
+ function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
|
|
|
+ // TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
|
|
|
+ // TODO: 清除token,token登录返回
|
|
|
+ db.SaveChanges();
|
|
|
+
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
#region 开启
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -544,6 +651,101 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+ #region 一键企业创客
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 一键企业创客
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public string OpenEnterpriseMaker(string Id)
|
|
|
+ {
|
|
|
+ string[] idlist = Id.Split(new char[] { ',' });
|
|
|
+ AddSysLog(Id, "Users", "OpenEnterpriseMaker");
|
|
|
+ foreach (string subid in idlist)
|
|
|
+ {
|
|
|
+ int id = int.Parse(subid);
|
|
|
+ Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
+ Fields.Add("BusinessFlag", 1);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 关闭企业创客
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 关闭企业创客
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public string CloseEnterpriseMaker(string Id)
|
|
|
+ {
|
|
|
+ string[] idlist = Id.Split(new char[] { ',' });
|
|
|
+ AddSysLog(Id, "Users", "CloseEnterpriseMaker");
|
|
|
+ foreach (string subid in idlist)
|
|
|
+ {
|
|
|
+ int id = int.Parse(subid);
|
|
|
+ Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
+ Fields.Add("BusinessFlag", 0);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 一键大盟主
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 一键大盟主
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public string SetBigLeader(string Id)
|
|
|
+ {
|
|
|
+ string[] idlist = Id.Split(new char[] { ',' });
|
|
|
+ AddSysLog(Id, "Users", "SetBigLeader");
|
|
|
+ foreach (string subid in idlist)
|
|
|
+ {
|
|
|
+ int id = int.Parse(subid);
|
|
|
+ Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
+ Fields.Add("LeaderLevel", 2);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 一键小盟主
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 一键小盟主
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public string SetSmallLeader(string Id)
|
|
|
+ {
|
|
|
+ string[] idlist = Id.Split(new char[] { ',' });
|
|
|
+ AddSysLog(Id, "Users", "SetSmallLeader");
|
|
|
+ foreach (string subid in idlist)
|
|
|
+ {
|
|
|
+ int id = int.Parse(subid);
|
|
|
+ Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
+ Fields.Add("LeaderLevel", 1);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
#region 风控
|
|
|
|
|
|
public IActionResult Risk(string right, int Id = 0)
|
|
|
@@ -641,7 +843,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
string SettleAmount = dr[2].ToString();
|
|
|
UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
if (UserCode != null)
|
|
|
- {
|
|
|
+ {
|
|
|
Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
|
|
|
if (User != null)
|
|
|
{
|
|
|
@@ -660,7 +862,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
string CashFreezeAmt = dr[2].ToString();
|
|
|
UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
if (UserCode != null)
|
|
|
- {
|
|
|
+ {
|
|
|
Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
|
|
|
if (User != null)
|
|
|
{
|
|
|
@@ -680,7 +882,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
string RiskNote = dr[3].ToString();
|
|
|
UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
if (UserCode != null)
|
|
|
- {
|
|
|
+ {
|
|
|
Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
|
|
|
if (User != null)
|
|
|
{
|
|
|
@@ -691,6 +893,101 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
}
|
|
|
+ else if (Kind == 4)
|
|
|
+ {
|
|
|
+ string error = "";
|
|
|
+ for (int i = 1; i < list.Count; i++)
|
|
|
+ {
|
|
|
+ JsonData dr = list[i];
|
|
|
+ string MakerCode = dr[0].ToString();
|
|
|
+ string OperationAmt = dr[2].ToString();//操作金额
|
|
|
+ string OperationType = dr[3].ToString();//操作类型
|
|
|
+
|
|
|
+ UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
+ if (UserCode != null)
|
|
|
+ {
|
|
|
+ Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
|
|
|
+ UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == User.Id);
|
|
|
+ if (account == null)
|
|
|
+ {
|
|
|
+ account = db.UserAccount.Add(new UserAccount()
|
|
|
+ {
|
|
|
+ Id = User.Id,
|
|
|
+ UserId = User.Id,
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ if (User != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
+ decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
+ decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
+ int ChangeType = 0;
|
|
|
+ if (OperationType == "1" && Convert.ToDecimal(OperationAmt) <= account.BalanceAmount)
|
|
|
+ {
|
|
|
+ account.BalanceAmount -= Convert.ToDecimal(OperationAmt);
|
|
|
+ account.FreezeAmount += Convert.ToDecimal(OperationAmt);
|
|
|
+ ChangeType = 61;
|
|
|
+ }
|
|
|
+ else if (OperationType == "1" && Convert.ToDecimal(OperationAmt) > account.BalanceAmount)
|
|
|
+ {
|
|
|
+ error += "以下操作失败" + User.MakerCode + ',' + User.RealName + "冻结金额大于余额" + '|' + '\n';
|
|
|
+ }
|
|
|
+ else if (OperationType == "2" && Convert.ToDecimal(OperationAmt) <= account.FreezeAmount)
|
|
|
+ {
|
|
|
+ account.BalanceAmount += Convert.ToDecimal(OperationAmt);
|
|
|
+ account.FreezeAmount -= Convert.ToDecimal(OperationAmt);
|
|
|
+ ChangeType = 62;
|
|
|
+ }
|
|
|
+ else if (OperationType == "2" && Convert.ToDecimal(OperationAmt) > account.FreezeAmount)
|
|
|
+ {
|
|
|
+ error += "以下操作失败" + User.MakerCode + ',' + User.RealName + "解冻金额大于冻结金额" + '|' + '\n';
|
|
|
+ }
|
|
|
+ else if (OperationType == "3" && Convert.ToDecimal(OperationAmt) <= account.BalanceAmount)
|
|
|
+ {
|
|
|
+ account.TotalAmount -= Convert.ToDecimal(OperationAmt);
|
|
|
+ account.BalanceAmount -= Convert.ToDecimal(OperationAmt);
|
|
|
+ ChangeType = 63;
|
|
|
+ }
|
|
|
+ else if (OperationType == "3" && Convert.ToDecimal(OperationAmt) > account.BalanceAmount)
|
|
|
+ {
|
|
|
+ error += "以下操作失败" + User.MakerCode + ',' + User.RealName + "扣减金额大于余额" + '|' + '\n';
|
|
|
+ }
|
|
|
+ else if (OperationType == "4")
|
|
|
+ {
|
|
|
+ account.TotalAmount += Convert.ToDecimal(OperationAmt);
|
|
|
+ account.BalanceAmount += Convert.ToDecimal(OperationAmt);
|
|
|
+ ChangeType = 64;
|
|
|
+ }
|
|
|
+ decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
+ decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
+ decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
+ UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UpdateDate = DateTime.Now,
|
|
|
+ UserId = User.Id, //创客
|
|
|
+ ChangeType = ChangeType, //变动类型
|
|
|
+ ChangeAmount = Convert.ToDecimal(OperationAmt), //变更金额
|
|
|
+ BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
+ AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
+ BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
+ AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
+ BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
+ AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
+ Remark = dr[4].ToString(),
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ AddSysLog(User.Id.ToString(), "Users", "ChangeCashFreezeAmts");
|
|
|
+ db.SaveChanges();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.SaveChanges();
|
|
|
+ return "warning" + error;
|
|
|
+ }
|
|
|
AddSysLog("0", "Users", "Import");
|
|
|
return "success";
|
|
|
}
|
|
|
@@ -726,22 +1023,22 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
|
|
|
}
|
|
|
//实名状态
|
|
|
- if(!string.IsNullOrEmpty(AuthFlagSelect))
|
|
|
+ if (!string.IsNullOrEmpty(AuthFlagSelect))
|
|
|
{
|
|
|
condition += " and AuthFlag=" + AuthFlagSelect;
|
|
|
}
|
|
|
//顶级创客
|
|
|
- if(TopUserId > 0)
|
|
|
+ if (TopUserId > 0)
|
|
|
{
|
|
|
condition += " and ParentNav like '," + TopUserId + ",%'";
|
|
|
}
|
|
|
//风控标识
|
|
|
- if(!string.IsNullOrEmpty(RiskFlagSelect))
|
|
|
+ if (!string.IsNullOrEmpty(RiskFlagSelect))
|
|
|
{
|
|
|
condition += " and RiskFlag=" + RiskFlagSelect;
|
|
|
}
|
|
|
//商户创客类型
|
|
|
- if(!string.IsNullOrEmpty(MerchantTypeSelect))
|
|
|
+ if (!string.IsNullOrEmpty(MerchantTypeSelect))
|
|
|
{
|
|
|
condition += " and MerchantType=" + MerchantTypeSelect;
|
|
|
}
|
|
|
@@ -755,7 +1052,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
}
|
|
|
if (ParentId > 0)
|
|
|
- {
|
|
|
+ {
|
|
|
condition += " and ParentUserId=" + ParentId;
|
|
|
}
|
|
|
|
|
|
@@ -773,7 +1070,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
dic["ParentRealName"] = puser.RealName;
|
|
|
string ParentNav = dic["ParentNav"].ToString();
|
|
|
if (!string.IsNullOrEmpty(ParentNav))
|
|
|
- {
|
|
|
+ {
|
|
|
string[] list = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
if (list.Length > 1)
|
|
|
{
|
|
|
@@ -816,6 +1113,121 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+ #region 直属创客导出Excel
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 直属创客导出Excel
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public JsonResult ExportZSExcel(Users data, string MakerCode, string ParentMakerCode)
|
|
|
+ {
|
|
|
+ Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ string condition = " and Status>-1";
|
|
|
+ //创客编号
|
|
|
+ if (!string.IsNullOrEmpty(MakerCode))
|
|
|
+ {
|
|
|
+ condition += " and ParentUserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
|
|
|
+ }
|
|
|
+ //直属创客编号
|
|
|
+ if (!string.IsNullOrEmpty(ParentMakerCode))
|
|
|
+ {
|
|
|
+ condition += " and ParentUserId in (select UserId from UserForMakerCode where MakerCode='" + ParentMakerCode + "')";
|
|
|
+ }
|
|
|
+
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, "Id desc", "True", 1, 20000, condition, "Id,MakerCode,RealName,UserLevel", false);
|
|
|
+ List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
+ foreach (Dictionary<string, object> dic in diclist)
|
|
|
+ {
|
|
|
+ int Id = int.Parse(dic["Id"].ToString());
|
|
|
+ Users userZS = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
|
|
|
+ dic["MakerCode"] = userZS.MakerCode;
|
|
|
+ dic["RealName"] = userZS.RealName;
|
|
|
+ dic["UserLevel"] = RelationClass.GetUserLevelSetInfo(int.Parse(dic["UserLevel"].ToString()));
|
|
|
+ }
|
|
|
+ Dictionary<string, object> result = new Dictionary<string, object>();
|
|
|
+ result.Add("Status", "1");
|
|
|
+ result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
|
|
|
+ result.Add("Obj", diclist);
|
|
|
+ Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
|
|
|
+
|
|
|
+ ReturnFields.Add("Id", "Id");
|
|
|
+ ReturnFields.Add("MakerCode", "创客编号");
|
|
|
+ ReturnFields.Add("RealName", "创客姓名");
|
|
|
+ ReturnFields.Add("UserLevel", "创客等级");
|
|
|
+
|
|
|
+ result.Add("Fields", ReturnFields);
|
|
|
+ AddSysLog("0", "Users", "ExportZSExcel");
|
|
|
+ return Json(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 上级创客导出Excel
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 上级创客导出Excel
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public JsonResult ExportSJExcel(Users data, string MakerCode, string ParentMakerCode)
|
|
|
+ {
|
|
|
+ Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ string condition = " and Status>-1";
|
|
|
+ //创客编号
|
|
|
+ if (!string.IsNullOrEmpty(MakerCode))
|
|
|
+ {
|
|
|
+ var query = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
+ Users self = db.Users.FirstOrDefault(m => m.Id == query.UserId);
|
|
|
+ if (self != null)
|
|
|
+ {
|
|
|
+ string ParentNav = function.CheckNull(self.ParentNav);
|
|
|
+ condition += " and Id in (" + ParentNav.Trim(',').Replace(",,", ",") + ")";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //直属创客编号
|
|
|
+ if (!string.IsNullOrEmpty(ParentMakerCode))
|
|
|
+ {
|
|
|
+ var query = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == ParentMakerCode);
|
|
|
+ Users self = db.Users.FirstOrDefault(m => m.Id == query.UserId);
|
|
|
+ if (self != null)
|
|
|
+ {
|
|
|
+ string ParentNav = function.CheckNull(self.ParentNav);
|
|
|
+ condition += " and Id in (" + ParentNav.Trim(',').Replace(",,", ",") + ")";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, "Id desc", "True", 1, 20000, condition, "Id,MakerCode,RealName,UserLevel", false);
|
|
|
+ List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
+ foreach (Dictionary<string, object> dic in diclist)
|
|
|
+ {
|
|
|
+ int Id = int.Parse(dic["Id"].ToString());
|
|
|
+ Users userSJ = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
|
|
|
+ dic["MakerCode"] = userSJ.MakerCode;
|
|
|
+ dic["RealName"] = userSJ.RealName;
|
|
|
+ dic["UserLevel"] = RelationClass.GetUserLevelSetInfo(int.Parse(dic["UserLevel"].ToString()));
|
|
|
+ }
|
|
|
+ Dictionary<string, object> result = new Dictionary<string, object>();
|
|
|
+ result.Add("Status", "1");
|
|
|
+ result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
|
|
|
+ result.Add("Obj", diclist);
|
|
|
+ Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
|
|
|
+
|
|
|
+ ReturnFields.Add("Id", "Id");
|
|
|
+ ReturnFields.Add("MakerCode", "创客编号");
|
|
|
+ ReturnFields.Add("RealName", "创客姓名");
|
|
|
+ ReturnFields.Add("UserLevel", "创客等级");
|
|
|
+
|
|
|
+ result.Add("Fields", ReturnFields);
|
|
|
+ AddSysLog("0", "Users", "ExportExcel");
|
|
|
+ return Json(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
#region 同步数据
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -827,20 +1239,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
var Brands = db.KqProducts.Where(m => m.Status == 1).ToList();
|
|
|
foreach (var Brand in Brands)
|
|
|
{
|
|
|
- string IdBrand = Id + "_" + Brand.Id;
|
|
|
- UserMachineData machineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
- if (machineData == null)
|
|
|
- {
|
|
|
- machineData = db.UserMachineData.Add(new UserMachineData()
|
|
|
- {
|
|
|
- IdBrand = IdBrand
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
- }
|
|
|
- machineData.BindCount = db.PosMachinesTwo.Count(m => m.BuyUserId == Id && m.BrandId == Brand.Id && m.BindingState == 1);
|
|
|
- machineData.UnBindCount = db.PosMachinesTwo.Count(m => m.BuyUserId == Id && m.BrandId == Brand.Id && m.BindingState == 0);
|
|
|
- machineData.TotalMachineCount = machineData.BindCount + machineData.UnBindCount;
|
|
|
- db.SaveChanges();
|
|
|
+ PublicFunction.SycnMachineCount(Id, Brand.Id);
|
|
|
// RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, machineData);
|
|
|
// RedisDbconn.Instance.SetExpire("UserMachineData:" + IdBrand, function.get_Random(1800, 5400));
|
|
|
}
|
|
|
@@ -867,7 +1266,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
#endregion
|
|
|
|
|
|
#region 同步交易额
|
|
|
-
|
|
|
+
|
|
|
[HttpPost]
|
|
|
public string SycnTradeAmountDo(DateTime sdate, DateTime edate, int UserId, int BrandId)
|
|
|
{
|
|
|
@@ -876,7 +1275,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
return "时间间隔不能超过1个月";
|
|
|
}
|
|
|
if (edate >= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"))
|
|
|
- {
|
|
|
+ {
|
|
|
return "结束时间只能是今天之前";
|
|
|
}
|
|
|
string check = RedisDbconn.Instance.Get<string>("ResetUserTradeQueue:" + UserId + ":" + BrandId);
|
|
|
@@ -939,7 +1338,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
|
|
|
}
|
|
|
//顶级创客
|
|
|
- if(TopUserId > 0)
|
|
|
+ if (TopUserId > 0)
|
|
|
{
|
|
|
condition += " and ParentNav like '," + TopUserId + ",%'";
|
|
|
}
|
|
|
@@ -954,7 +1353,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
dic["ParentRealName"] = puser.RealName;
|
|
|
string ParentNav = dic["ParentNav"].ToString();
|
|
|
if (!string.IsNullOrEmpty(ParentNav))
|
|
|
- {
|
|
|
+ {
|
|
|
int TopId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
|
|
|
dic["TopMakerCode"] = tuser.MakerCode;
|
|
|
@@ -992,22 +1391,22 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
|
|
|
}
|
|
|
//实名状态
|
|
|
- if(!string.IsNullOrEmpty(AuthFlagSelect))
|
|
|
+ if (!string.IsNullOrEmpty(AuthFlagSelect))
|
|
|
{
|
|
|
condition += " and AuthFlag=" + AuthFlagSelect;
|
|
|
}
|
|
|
//顶级创客
|
|
|
- if(TopUserId > 0)
|
|
|
+ if (TopUserId > 0)
|
|
|
{
|
|
|
condition += " and ParentNav like '," + TopUserId + ",%'";
|
|
|
}
|
|
|
//风控标识
|
|
|
- if(!string.IsNullOrEmpty(RiskFlagSelect))
|
|
|
+ if (!string.IsNullOrEmpty(RiskFlagSelect))
|
|
|
{
|
|
|
condition += " and RiskFlag=" + RiskFlagSelect;
|
|
|
}
|
|
|
//商户创客类型
|
|
|
- if(!string.IsNullOrEmpty(MerchantTypeSelect))
|
|
|
+ if (!string.IsNullOrEmpty(MerchantTypeSelect))
|
|
|
{
|
|
|
condition += " and MerchantType=" + MerchantTypeSelect;
|
|
|
}
|
|
|
@@ -1026,7 +1425,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
dic["ParentRealName"] = puser.RealName;
|
|
|
string ParentNav = dic["ParentNav"].ToString();
|
|
|
if (!string.IsNullOrEmpty(ParentNav))
|
|
|
- {
|
|
|
+ {
|
|
|
int TopId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
|
|
|
dic["TopMakerCode"] = tuser.MakerCode;
|
|
|
@@ -1065,5 +1464,355 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+ #region 根据条件查询直属创客交易额列表
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 直属创客交易额列表
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public IActionResult Children(Users data, string right, int ParentId = 0, string MakerCode = "")
|
|
|
+ {
|
|
|
+ ViewBag.RightInfo = RightInfo;
|
|
|
+ ViewBag.right = right;
|
|
|
+ ViewBag.ParentId = ParentId.ToString();
|
|
|
+ ViewBag.MakerCode = MakerCode;
|
|
|
+
|
|
|
+ List<Users> TopUsers = db.Users.Where(m => m.ParentUserId == 0).ToList();
|
|
|
+ ViewBag.TopUsers = TopUsers;
|
|
|
+ List<UserLevelSet> Levels = db.UserLevelSet.OrderBy(m => m.Id).ToList();
|
|
|
+ ViewBag.Levels = Levels;
|
|
|
+ List<KqProducts> Brands = db.KqProducts.OrderBy(m => m.Id).ToList();
|
|
|
+ ViewBag.Brands = Brands;
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 根据条件查询直属创客交易额列表
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 直属创客交易额列表
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public JsonResult ChildrenData(Users data, int BrandSelect, string MakerCode, string CreateDateData, int ParentId = 0, int page = 1, int limit = 30)
|
|
|
+ {
|
|
|
+ Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
+ Fields.Add("MakerCode", "1"); //创客编号
|
|
|
+
|
|
|
+ int BrandId = BrandSelect;
|
|
|
+ string start = "";
|
|
|
+ string end = "";
|
|
|
+
|
|
|
+ string condition = " and Status>-1";
|
|
|
+ string con = " and Status>-1";
|
|
|
+ // string cons = " and Status>=-1";
|
|
|
+ string sort = "Id desc";
|
|
|
+ //创客编号
|
|
|
+ if (!string.IsNullOrEmpty(MakerCode))
|
|
|
+ {
|
|
|
+ condition += " and Id in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
|
|
|
+ }
|
|
|
+ if (ParentId > 0)
|
|
|
+ {
|
|
|
+ condition += " and ParentUserId=" + ParentId + " or Id=" + ParentId;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(CreateDateData))
|
|
|
+ {
|
|
|
+ string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
+ start = datelist[0].Replace("-", "");
|
|
|
+ end = datelist[1].Replace("-", "");
|
|
|
+ con += " and TradeDate>='" + start + "' and TradeDate<='" + end + "'";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(BrandSelect.ToString()) && BrandId > 0)
|
|
|
+ {
|
|
|
+ con += " and BrandId='" + BrandId + "'";
|
|
|
+ }
|
|
|
+
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, sort, "True", page, limit, condition);
|
|
|
+ List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
+ foreach (Dictionary<string, object> dic in diclist)
|
|
|
+ {
|
|
|
+ int UId = int.Parse(dic["Id"].ToString());
|
|
|
+ var Info = GetMonthTradeForBrand(UId, start, end, BrandId);
|
|
|
+
|
|
|
+ dic["TotalAmtfc"] = Convert.ToDecimal(Info["TotalAmtfc"].ToString()) + Convert.ToDecimal(Info["YAmtfc"].ToString());
|
|
|
+ dic["DAmtfc"] = Convert.ToDecimal(Info["DAmtfc"].ToString());
|
|
|
+ dic["JAmtfc"] = Convert.ToDecimal(Info["JAmtfc"].ToString());
|
|
|
+ dic["JfAmtfc"] = Convert.ToDecimal(Info["JfAmtfc"].ToString());
|
|
|
+ dic["JCountfc"] = Convert.ToInt32(Info["JCountfc"].ToString());
|
|
|
+ dic["YAmtfc"] = Convert.ToDecimal(Info["YAmtfc"].ToString());
|
|
|
+
|
|
|
+ dic["TotalAmtwd"] = Convert.ToDecimal(Info["TotalAmtwd"].ToString()) + Convert.ToDecimal(Info["YAmtwd"].ToString());
|
|
|
+ dic["DAmtwd"] = Convert.ToDecimal(Info["DAmtwd"].ToString());
|
|
|
+ dic["JAmtwd"] = Convert.ToDecimal(Info["JAmtwd"].ToString());
|
|
|
+ dic["JfAmtwd"] = Convert.ToDecimal(Info["JfAmtwd"].ToString());
|
|
|
+ dic["JCountwd"] = Convert.ToInt32(Info["JCountwd"].ToString());
|
|
|
+ dic["YAmtwd"] = Convert.ToDecimal(Info["YAmtwd"].ToString());
|
|
|
+
|
|
|
+ dic["BCount"] = Info["BCount"].ToString();
|
|
|
+ dic["ACount"] = Info["ACount"].ToString();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //扶持期
|
|
|
+ decimal TotalAmtfc = 0;
|
|
|
+ decimal DAmtfc = 0;
|
|
|
+ decimal JAmtfc = 0;
|
|
|
+ decimal JfAmtfc = 0;
|
|
|
+ int JCountfc = 0;
|
|
|
+ decimal YAmtfc = 0;
|
|
|
+
|
|
|
+ //稳定期
|
|
|
+ decimal TotalAmtwd = 0;
|
|
|
+ decimal DAmtwd = 0;
|
|
|
+ decimal JAmtwd = 0;
|
|
|
+ decimal JfAmtwd = 0;
|
|
|
+ int JCountwd = 0;
|
|
|
+ decimal YAmtwd = 0;
|
|
|
+
|
|
|
+ // int BCount = 0;
|
|
|
+ // int ACount = 0;
|
|
|
+
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ Dictionary<string, object> other = new Dictionary<string, object>();
|
|
|
+ DataTable dt = OtherMySqlConn.dtable("select Sum(HelpDirectTradeAmt + HelpDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ TotalAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitTradeAmt),Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JfAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JCountfc = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ YAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectTradeAmt + NotHelpDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ TotalAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitTradeAmt),Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JfAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ // dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=0 AND UserId= '" + ParentId + "'" + cons);
|
|
|
+ // if (dt.Rows.Count > 0)
|
|
|
+ // {
|
|
|
+ // BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ // }
|
|
|
+ // dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=1 AND UserId= '" + ParentId + "'" + cons);
|
|
|
+ // if (dt.Rows.Count > 0)
|
|
|
+ // {
|
|
|
+ // ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ // }
|
|
|
+
|
|
|
+ other.Add("TotalAmtfc", TotalAmtfc);
|
|
|
+ other.Add("DAmtfc", DAmtfc);
|
|
|
+ other.Add("JAmtfc", JAmtfc);
|
|
|
+ other.Add("JfAmtfc", JfAmtfc);
|
|
|
+ other.Add("JCountfc", JCountfc);
|
|
|
+ other.Add("YAmtfc", YAmtfc);
|
|
|
+
|
|
|
+ other.Add("TotalAmtwd", TotalAmtwd);
|
|
|
+ other.Add("DAmtwd", DAmtwd);
|
|
|
+ other.Add("JAmtwd", JAmtwd);
|
|
|
+ other.Add("JfAmtwd", JfAmtwd);
|
|
|
+ other.Add("JCountwd", JCountwd);
|
|
|
+ other.Add("YAmtwd", YAmtwd);
|
|
|
+
|
|
|
+ // other.Add("BCount", BCount);
|
|
|
+ // other.Add("ACount", ACount);
|
|
|
+ db.Dispose();
|
|
|
+ obj.Add("other", other);
|
|
|
+
|
|
|
+ return Json(obj);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Dictionary<string, object> GetMonthTradeForBrand(int UserId, string sTradeDate, string eTradeDate, int BrandId)
|
|
|
+ {
|
|
|
+ string condition = " and Status>-1";
|
|
|
+ string cons = " and Status>=-1";
|
|
|
+
|
|
|
+ //产品类型
|
|
|
+ if (!string.IsNullOrEmpty(BrandId.ToString()) && BrandId > 0)
|
|
|
+ {
|
|
|
+ condition += " and BrandId =" + BrandId;
|
|
|
+ cons += " and BrandId =" + BrandId;
|
|
|
+ }
|
|
|
+ //创客Id
|
|
|
+ if (!string.IsNullOrEmpty(UserId.ToString()))
|
|
|
+ {
|
|
|
+ condition += " and UserId =" + UserId;
|
|
|
+ }
|
|
|
+ //开始时间
|
|
|
+ if (!string.IsNullOrEmpty(sTradeDate))
|
|
|
+ {
|
|
|
+ condition += " and TradeDate >=" + Convert.ToInt32(sTradeDate);
|
|
|
+ cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') >=" + Convert.ToInt32(sTradeDate);
|
|
|
+ }
|
|
|
+ //结束时间
|
|
|
+ if (!string.IsNullOrEmpty(eTradeDate))
|
|
|
+ {
|
|
|
+ condition += " and TradeDate <=" + Convert.ToInt32(eTradeDate);
|
|
|
+ cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') <=" + Convert.ToInt32(eTradeDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ //扶持期
|
|
|
+ decimal TotalAmtfc = 0;
|
|
|
+ decimal DAmtfc = 0;
|
|
|
+ decimal JAmtfc = 0;
|
|
|
+ decimal JfAmtfc = 0;
|
|
|
+ int JCountfc = 0;
|
|
|
+ decimal YAmtfc = 0;
|
|
|
+
|
|
|
+ //稳定期
|
|
|
+ decimal TotalAmtwd = 0;
|
|
|
+ decimal DAmtwd = 0;
|
|
|
+ decimal JAmtwd = 0;
|
|
|
+ decimal JfAmtwd = 0;
|
|
|
+ int JCountwd = 0;
|
|
|
+ decimal YAmtwd = 0;
|
|
|
+
|
|
|
+ int BCount = 0;
|
|
|
+ int ACount = 0;
|
|
|
+
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ Dictionary<string, object> obj = new Dictionary<string, object>();
|
|
|
+ DataTable dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt + HelpNonDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ TotalAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectDebitTradeAmt),Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JfAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JCountfc = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ YAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt + NotHelpNonDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ TotalAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectDebitTradeAmt),Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JfAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='team'" + condition);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND UserId= '" + UserId + "'" + cons);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+ dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE ActivationState=1 AND UserId= '" + UserId + "'" + cons);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ obj.Add("TotalAmtfc", TotalAmtfc);
|
|
|
+ obj.Add("DAmtfc", DAmtfc);
|
|
|
+ obj.Add("JAmtfc", JAmtfc);
|
|
|
+ obj.Add("JfAmtfc", JfAmtfc);
|
|
|
+ obj.Add("JCountfc", JCountfc);
|
|
|
+ obj.Add("YAmtfc", YAmtfc);
|
|
|
+
|
|
|
+ obj.Add("TotalAmtwd", TotalAmtwd);
|
|
|
+ obj.Add("DAmtwd", DAmtwd);
|
|
|
+ obj.Add("JAmtwd", JAmtwd);
|
|
|
+ obj.Add("JfAmtwd", JfAmtwd);
|
|
|
+ obj.Add("JCountwd", JCountwd);
|
|
|
+ obj.Add("YAmtwd", YAmtwd);
|
|
|
+
|
|
|
+ obj.Add("BCount", BCount);
|
|
|
+ obj.Add("ACount", ACount);
|
|
|
+ db.Dispose();
|
|
|
+ return obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|