|
@@ -304,4 +304,183 @@ public class TestHelper
|
|
db.Dispose();
|
|
db.Dispose();
|
|
function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "执行商户交易额日志");
|
|
function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "执行商户交易额日志");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //统计团队交易额(小市场)
|
|
|
|
+ public void teamTrade()
|
|
|
|
+ {
|
|
|
|
+ Dictionary<int, decimal> userdic = new Dictionary<int, decimal>();
|
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
|
+ OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
|
+ function.WriteLog("start:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "团队交易额名单");
|
|
|
|
+ DataTable dt = OtherMySqlConn.dtable("select UserId,sum(HelpNonDirectTradeAmt+NotHelpNonDirectTradeAmt+HelpNonDirectDebitTradeAmt+NotHelpNonDirectDebitTradeAmt) from TradeDaySummary where TradeMonth='202208' and SeoTitle='team' group by UserId");
|
|
|
|
+ function.WriteLog("ready:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "团队交易额名单");
|
|
|
|
+ foreach(DataRow dr in dt.Rows)
|
|
|
|
+ {
|
|
|
|
+ int UserId = int.Parse(function.CheckInt(dr["UserId"].ToString()));
|
|
|
|
+ decimal TradeAmount = decimal.Parse(function.CheckNum(dr[1].ToString()));
|
|
|
|
+ userdic.Add(UserId, TradeAmount);
|
|
|
|
+ }
|
|
|
|
+ function.WriteLog("1:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "团队交易额名单");
|
|
|
|
+ Dictionary<int, decimal> userdic1 = userdic.Where(m => m.Value >= 3000000 && m.Value <= 10000000).ToDictionary(m => m.Key, m => m.Value);
|
|
|
|
+ function.WriteLog("3000000:" + userdic1.Count(), "团队交易额名单");
|
|
|
|
+ foreach(int UserId in userdic1.Keys)
|
|
|
|
+ {
|
|
|
|
+ decimal curTotal = userdic1[UserId];
|
|
|
|
+ List<int> ids = new List<int>();
|
|
|
|
+ Users self = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
|
+ int TopUserId = 0;
|
|
|
|
+ if (!string.IsNullOrEmpty(self.ParentNav))
|
|
|
|
+ {
|
|
|
|
+ string uidstring = self.ParentNav.Trim(',').Replace(",,", ",");
|
|
|
|
+ string[] uidlist = uidstring.Split(',');
|
|
|
|
+ if (uidlist.Length > 1)
|
|
|
|
+ {
|
|
|
|
+ TopUserId = int.Parse(function.CheckInt(uidlist[1]));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ TopUserId = int.Parse(function.CheckInt(uidlist[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Users top = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
|
|
|
|
+ var users = db.Users.Select(m => new { m.Id, m.ParentUserId }).Where(m => m.ParentUserId == UserId).ToList();
|
|
|
|
+ foreach(var user in users)
|
|
|
|
+ {
|
|
|
|
+ ids.Add(user.Id);
|
|
|
|
+ }
|
|
|
|
+ int index = 0;
|
|
|
|
+ decimal totalAmt = 0;
|
|
|
|
+ decimal maxAmt = 0;
|
|
|
|
+ Dictionary<int, decimal> dic = userdic.Where(m => ids.Contains(m.Key)).OrderByDescending(m => m.Value).ToDictionary(m => m.Key, m => m.Value);
|
|
|
|
+ foreach(int key in dic.Keys)
|
|
|
|
+ {
|
|
|
|
+ index += 1;
|
|
|
|
+ if(index > 1)
|
|
|
|
+ {
|
|
|
|
+ totalAmt += dic[key];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ maxAmt = dic[key];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(totalAmt >= 1200000)
|
|
|
|
+ {
|
|
|
|
+ function.WriteLog(self.MakerCode + "--" + self.RealName + "--" + self.Mobile + "--" + top.MakerCode + "--" + top.RealName + "--" + top.Mobile + "--" + curTotal + "--" + maxAmt + "--" + totalAmt, "团队交易额300万-1000万且小市场大于120万的名单");
|
|
|
|
+ }
|
|
|
|
+ if(totalAmt >= curTotal * 0.4M)
|
|
|
|
+ {
|
|
|
|
+ function.WriteLog(self.MakerCode + "--" + self.RealName + "--" + self.Mobile + "--" + top.MakerCode + "--" + top.RealName + "--" + top.Mobile + "--" + curTotal + "--" + maxAmt + "--" + totalAmt, "团队交易额300万-1000万且小市场大于40%的名单");
|
|
|
|
+ }
|
|
|
|
+ function.WriteLog(UserId.ToString(), "团队交易额名单");
|
|
|
|
+ }
|
|
|
|
+ Dictionary<int, decimal> userdic2 = userdic.Where(m => m.Value >= 10000000 && m.Value <= 100000000).ToDictionary(m => m.Key, m => m.Value);
|
|
|
|
+ function.WriteLog("10000000:" + userdic2.Count(), "团队交易额名单");
|
|
|
|
+ foreach(int UserId in userdic2.Keys)
|
|
|
|
+ {
|
|
|
|
+ decimal curTotal = userdic2[UserId];
|
|
|
|
+ List<int> ids = new List<int>();
|
|
|
|
+ Users self = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
|
+ int TopUserId = 0;
|
|
|
|
+ if (!string.IsNullOrEmpty(self.ParentNav))
|
|
|
|
+ {
|
|
|
|
+ string uidstring = self.ParentNav.Trim(',').Replace(",,", ",");
|
|
|
|
+ string[] uidlist = uidstring.Split(',');
|
|
|
|
+ if (uidlist.Length > 1)
|
|
|
|
+ {
|
|
|
|
+ TopUserId = int.Parse(function.CheckInt(uidlist[1]));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ TopUserId = int.Parse(function.CheckInt(uidlist[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Users top = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
|
|
|
|
+ var users = db.Users.Select(m => new { m.Id, m.ParentUserId }).Where(m => m.ParentUserId == UserId).ToList();
|
|
|
|
+ foreach(var user in users)
|
|
|
|
+ {
|
|
|
|
+ ids.Add(user.Id);
|
|
|
|
+ }
|
|
|
|
+ int index = 0;
|
|
|
|
+ decimal totalAmt = 0;
|
|
|
|
+ decimal maxAmt = 0;
|
|
|
|
+ Dictionary<int, decimal> dic = userdic.Where(m => ids.Contains(m.Key)).OrderByDescending(m => m.Value).ToDictionary(m => m.Key, m => m.Value);
|
|
|
|
+ foreach(int key in dic.Keys)
|
|
|
|
+ {
|
|
|
|
+ index += 1;
|
|
|
|
+ if(index > 1)
|
|
|
|
+ {
|
|
|
|
+ totalAmt += dic[key];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ maxAmt = dic[key];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(totalAmt >= 4000000)
|
|
|
|
+ {
|
|
|
|
+ function.WriteLog(self.MakerCode + "--" + self.RealName + "--" + self.Mobile + "--" + top.MakerCode + "--" + top.RealName + "--" + top.Mobile + "--" + curTotal + "--" + maxAmt + "--" + totalAmt, "团队交易额1000万-1亿且小市场大于400万的名单");
|
|
|
|
+ }
|
|
|
|
+ if(totalAmt >= curTotal * 0.4M)
|
|
|
|
+ {
|
|
|
|
+ function.WriteLog(self.MakerCode + "--" + self.RealName + "--" + self.Mobile + "--" + top.MakerCode + "--" + top.RealName + "--" + top.Mobile + "--" + curTotal + "--" + maxAmt + "--" + totalAmt, "团队交易额1000万-1亿且小市场大于40%的名单");
|
|
|
|
+ }
|
|
|
|
+ function.WriteLog(UserId.ToString(), "团队交易额名单");
|
|
|
|
+ }
|
|
|
|
+ Dictionary<int, decimal> userdic3 = userdic.Where(m => m.Value >= 100000000).ToDictionary(m => m.Key, m => m.Value);
|
|
|
|
+ function.WriteLog("100000000:" + userdic3.Count(), "团队交易额名单");
|
|
|
|
+ foreach(int UserId in userdic3.Keys)
|
|
|
|
+ {
|
|
|
|
+ decimal curTotal = userdic3[UserId];
|
|
|
|
+ List<int> ids = new List<int>();
|
|
|
|
+ Users self = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
|
+ int TopUserId = 0;
|
|
|
|
+ if (!string.IsNullOrEmpty(self.ParentNav))
|
|
|
|
+ {
|
|
|
|
+ string uidstring = self.ParentNav.Trim(',').Replace(",,", ",");
|
|
|
|
+ string[] uidlist = uidstring.Split(',');
|
|
|
|
+ if (uidlist.Length > 1)
|
|
|
|
+ {
|
|
|
|
+ TopUserId = int.Parse(function.CheckInt(uidlist[1]));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ TopUserId = int.Parse(function.CheckInt(uidlist[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Users top = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
|
|
|
|
+ var users = db.Users.Select(m => new { m.Id, m.ParentUserId }).Where(m => m.ParentUserId == UserId).ToList();
|
|
|
|
+ foreach(var user in users)
|
|
|
|
+ {
|
|
|
|
+ ids.Add(user.Id);
|
|
|
|
+ }
|
|
|
|
+ int index = 0;
|
|
|
|
+ decimal totalAmt = 0;
|
|
|
|
+ decimal maxAmt = 0;
|
|
|
|
+ Dictionary<int, decimal> dic = userdic.Where(m => ids.Contains(m.Key)).OrderByDescending(m => m.Value).ToDictionary(m => m.Key, m => m.Value);
|
|
|
|
+ foreach(int key in dic.Keys)
|
|
|
|
+ {
|
|
|
|
+ index += 1;
|
|
|
|
+ if(index > 1)
|
|
|
|
+ {
|
|
|
|
+ totalAmt += dic[key];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ maxAmt = dic[key];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(totalAmt >= 40000000)
|
|
|
|
+ {
|
|
|
|
+ function.WriteLog(self.MakerCode + "--" + self.RealName + "--" + self.Mobile + "--" + top.MakerCode + "--" + top.RealName + "--" + top.Mobile + "--" + curTotal + "--" + maxAmt + "--" + totalAmt, "团队交易额1亿以上且小市场大于4000万的名单");
|
|
|
|
+ }
|
|
|
|
+ if(totalAmt >= curTotal * 0.4M)
|
|
|
|
+ {
|
|
|
|
+ function.WriteLog(self.MakerCode + "--" + self.RealName + "--" + self.Mobile + "--" + top.MakerCode + "--" + top.RealName + "--" + top.Mobile + "--" + curTotal + "--" + maxAmt + "--" + totalAmt, "团队交易额1亿以上且小市场大于40%的名单");
|
|
|
|
+ }
|
|
|
|
+ function.WriteLog(UserId.ToString(), "团队交易额名单");
|
|
|
|
+ }
|
|
|
|
+ db.Dispose();
|
|
|
|
+ function.WriteLog("end:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "团队交易额名单");
|
|
|
|
+ }
|
|
}
|
|
}
|