|
@@ -35,26 +35,13 @@ namespace MySystem
|
|
|
}
|
|
|
public void StatProfitDo()
|
|
|
{
|
|
|
- DateTime check = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01 00:00:00");
|
|
|
- DateTime end = DateTime.Parse(check.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") + " 00:00:00");
|
|
|
- while (check <= end)
|
|
|
- {
|
|
|
- StatProfitEveryDay(check.ToString("yyyyMMdd"));
|
|
|
- check = check.AddDays(1);
|
|
|
- }
|
|
|
-
|
|
|
- ProfitHelper.Instance.StatProfit();
|
|
|
- }
|
|
|
- public void StatProfitEveryDay(object sender)
|
|
|
- {
|
|
|
- string Date = sender.ToString();
|
|
|
- string Month = Date.Substring(0, 6);
|
|
|
- string check = function.ReadInstance("/ProfitStat/" + Date + ".txt");
|
|
|
+ string Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
|
|
|
+ string check = function.ReadInstance("/ProfitStat/" + Month + "-1.txt");
|
|
|
if (!string.IsNullOrEmpty(check))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- function.WritePage("/ProfitStat/", Date + ".txt", DateTime.Now.ToString());
|
|
|
+ function.WritePage("/ProfitStat/", Month + "-1.txt", DateTime.Now.ToString());
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
|
for (int i = 1; i <= 9; i++) //品牌
|
|
|
{
|
|
@@ -64,8 +51,8 @@ namespace MySystem
|
|
|
bool op = true;
|
|
|
while(op)
|
|
|
{
|
|
|
- function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":" + "BrandId:" + i + ",BankCardType:" + j + ",Date:" + Date + ",PageNum:" + PageNum, "分润监控日志");
|
|
|
- List<ProfitResult> result = StartProftForPosByDate(i, j, Date, PageNum);
|
|
|
+ function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":" + "BrandId:" + i + ",BankCardType:" + j + ",Month:" + Month + ",PageNum:" + PageNum, "分润监控日志");
|
|
|
+ List<ProfitResult> result = StartProftForPosByDate(i, j, Month, PageNum);
|
|
|
function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":" + "result:" + result.Count, "分润监控日志");
|
|
|
function.WriteLog("\r\n", "分润监控日志");
|
|
|
if(result.Count > 0)
|
|
@@ -91,50 +78,6 @@ namespace MySystem
|
|
|
decimal ProfitRate = sub.ProfitRate;
|
|
|
if (sub.IsSubsidy == 1 && j == 1)
|
|
|
{
|
|
|
- // decimal CreditTradeAmt = TradeAmt; //商户贷记卡交易总金额
|
|
|
- // decimal QrCreditTradeAmt = 0; //商户(云闪付)贷记卡交易总金额
|
|
|
- // decimal NonQrCreditTradeAmt = 0; //商户(非云闪付)贷记卡交易总金额
|
|
|
- // decimal CreditProfitRate = 0; //(非云闪付)贷记卡交易分润比例
|
|
|
- // decimal SubsidyProfit = 0; //商户(非云闪付)贷记卡交易分润补贴金额
|
|
|
- // if (sub.QrPayFlag == 1)
|
|
|
- // {
|
|
|
- // QrCreditTradeAmt = TradeAmt; //商户(云闪付)贷记卡交易总金额
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // NonQrCreditTradeAmt = TradeAmt; //商户(非云闪付)贷记卡交易总金额
|
|
|
- // CreditProfitRate = ProfitRate; //(非云闪付)贷记卡交易分润比例
|
|
|
- // SubsidyProfit = ProfitAmt; //商户(非云闪付)贷记卡交易分润补贴金额
|
|
|
- // }
|
|
|
- // // MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == sub.PosSn) ?? new MachineForSnNo();
|
|
|
- // // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
|
|
|
- // // PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == sub.MerchantId) ?? new PosMerchantInfo();
|
|
|
- // db.ProfitSubsidyDetail.Add(new ProfitSubsidyDetail()
|
|
|
- // {
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
- // UpdateDate = DateTime.Now,
|
|
|
- // RecordNo = RecordNo, //流水号
|
|
|
- // BrandId = sub.BrandId, //品牌
|
|
|
- // ProductName = RelationClass.GetKqProductBrandInfo(sub.BrandId), //产品名称
|
|
|
- // TradeMonth = Month, //交易月份
|
|
|
- // SeoTitle = Date,
|
|
|
- // MerchantId = sub.MerchantId, //商户
|
|
|
- // // MerNo = merchant.KqMerNo, //渠道商户编号
|
|
|
- // SnNo = sub.PosSn, //渠道SN号
|
|
|
- // // MerRegTime = pos.BindingTime, //渠道注册时间
|
|
|
- // // MerStandardDate = merchant.MerStandardDate, //商户激活时间
|
|
|
- // // BelongUserId = merchant.UserId, //商户归属人
|
|
|
- // MerHelpFlag = sub.HelpFlag == 1 ? 1u : 0u, //是否属于扶持周期内商户
|
|
|
- // SubsidyUserId = sub.UserId, //补贴人
|
|
|
- // SubsidyType = sub.DirectFlag, //分润补贴类型
|
|
|
- // SubsidyProfitRate = sub.Money, //创客活动期内直营商户分润万分之十
|
|
|
- // CreditTradeAmt = CreditTradeAmt, //商户贷记卡交易总金额
|
|
|
- // QrCreditTradeAmt = QrCreditTradeAmt, //商户(云闪付)贷记卡交易总金额
|
|
|
- // NonQrCreditTradeAmt = NonQrCreditTradeAmt, //商户(非云闪付)贷记卡交易总金额
|
|
|
- // CreditProfitRate = CreditProfitRate, //(非云闪付)贷记卡交易分润比例
|
|
|
- // SubsidyProfit = SubsidyProfit, //商户(非云闪付)贷记卡交易分润补贴金额
|
|
|
- // });
|
|
|
- // db.SaveChanges();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -267,7 +210,6 @@ namespace MySystem
|
|
|
TradeAmt = sub.TradeAmount, //商户交易总额
|
|
|
TradeProfit = sub.Money, //交易分润
|
|
|
TradeMonth = Month, //交易月
|
|
|
- SeoTitle = Date,
|
|
|
RecordNo = RecordNo, //记录单号
|
|
|
TopUserId = TopUserId, //顶级创客
|
|
|
CreditTradeAmt = CreditTradeAmt, //贷记卡交易总金额
|
|
@@ -326,8 +268,10 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
db.Dispose();
|
|
|
+
|
|
|
+ ProfitHelper.Instance.StatProfit();
|
|
|
}
|
|
|
- public List<ProfitResult> StartProftForPosByDate(int BrandId, int BankCardType, string Date, int PageNum = 1)
|
|
|
+ public List<ProfitResult> StartProftForPosByDate(int BrandId, int BankCardType, string Month, int PageNum = 1)
|
|
|
{
|
|
|
// 级差
|
|
|
/*
|
|
@@ -410,11 +354,11 @@ namespace MySystem
|
|
|
string sqlstr = "";
|
|
|
if (BankCardType == 1)
|
|
|
{
|
|
|
- sqlstr = "select UserId,QueryCount,sum(HelpDirectTradeAmt),sum(NotHelpDirectTradeAmt),sum(ProfitDirectTradeAmt) from TradeDaySummary where Id>2194000 and TradeDate='" + Date + "' and SeoTitle='self' and BrandId=" + BrandId + " group by UserId,QueryCount having sum(HelpDirectTradeAmt)>0 or sum(NotHelpDirectTradeAmt)>0 or sum(ProfitDirectTradeAmt)>0 order by UserId" + LimitString;
|
|
|
+ sqlstr = "select UserId,QrPayFlag,HelpDirectTradeAmt,NotHelpDirectTradeAmt,ProfitDirectTradeAmt from CreditTradeDaySummary" + Month + " where BrandId=" + BrandId + LimitString;
|
|
|
}
|
|
|
if (BankCardType == 0)
|
|
|
{
|
|
|
- sqlstr = "select UserId,QueryCount,sum(HelpDirectDebitTradeAmt),sum(NotHelpDirectDebitTradeAmt),sum(HelpDirectDebitCapTradeAmt),sum(NotHelpDirectDebitCapTradeAmt),sum(HelpDirectDebitCapNum),sum(NotHelpDirectDebitCapNum) from TradeDaySummary where Id>2194000 and TradeDate='" + Date + "' and SeoTitle='self' and BrandId=" + BrandId + " group by UserId,QueryCount having sum(HelpDirectDebitTradeAmt)>0 or sum(NotHelpDirectDebitTradeAmt)>0 or sum(HelpDirectDebitCapTradeAmt)>0 or sum(NotHelpDirectDebitCapTradeAmt)>0 order by UserId" + LimitString;
|
|
|
+ sqlstr = "select UserId,QrPayFlag,HelpDirectDebitTradeAmt,NotHelpDirectDebitTradeAmt,HelpDirectDebitCapTradeAmt,NotHelpDirectDebitCapTradeAmt,HelpDirectDebitCapNum,NotHelpDirectDebitCapNum,ProfitDirectDebitTradeAmt,ProfitDirectDebitCapTradeAmt,ProfitDirectDebitCapNum from DebitTradeDaySummary" + Month + " where BrandId=" + BrandId + LimitString;
|
|
|
}
|
|
|
function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + ":" + sqlstr, "分润监控日志");
|
|
|
DataTable dt = dbconn.dtable(sqlstr);
|
|
@@ -441,8 +385,6 @@ namespace MySystem
|
|
|
int HelpDirectDebitCapNum = int.Parse(dr[6].ToString().Split('.')[0]); //借记卡扶持期封顶交易笔数
|
|
|
int NotHelpDirectDebitCapNum = int.Parse(dr[7].ToString()); //借记卡稳定期封顶交易笔数
|
|
|
int UserLevel = selfUser.UserLevel; //当前会员等级
|
|
|
- // int LevelKindId = GetLevelKindId(BrandId, HelpTime, 0);
|
|
|
- // ProfitObjectLevels objlevel = RedisDbconn.Instance.Get<ProfitObjectLevels>("pobjlv" + LevelKindId + ":" + UserLevel); //获取当前等级参数
|
|
|
decimal getLevelProfit = (HelpDirectDebitTradeAmt + NotHelpDirectDebitTradeAmt - HelpDirectDebitCapTradeAmt - NotHelpDirectDebitCapTradeAmt) * 0.0006M + HelpDirectDebitCapNum + NotHelpDirectDebitCapNum;
|
|
|
result.Add(new ProfitResult()
|
|
|
{
|