1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using MySystem.Models.Main;
- using Library;
- using MySystem.Service.Main;
- using System.Collections.Generic;
- using System;
- namespace MySystem
- {
- /// <summary>
- /// 商户业绩统计工具类
- /// </summary>
- public class MerchantAmountSummayUtil
- {
- #region 已激活商户-达标信息列表
- /// <summary>
- /// 已激活商户-达标信息列表
- /// </summary>
- /// <param name="MerchantId">商户Id</param>
- /// <param name="PageSize">条数</param>
- /// <param name="PageNum">页数</param>
- /// <returns></returns>
- public static List<Dictionary<string, object>> ListDo(int MerchantId, int PageSize, int PageNum)
- {
- List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
- var query = MerchantDepositOrderService.Query(" 1=1 and Status>0 and MerchantId=" + MerchantId + "");
- if (query.Id > 0)
- {
- var month = DateTime.Parse(query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
- var TradeMonth = "";
- var TradeTime = "";
- Dictionary<string, string> dic = new Dictionary<string, string>();
- for (int i = 0; i < 10; i++)
- {
- var Status = 0;//活动交易状态
- decimal TradeAmount = 0.00M;
- TradeMonth = month.AddMonths(i + 1).ToString("yyyy-MM");
- TradeTime = month.AddMonths(i + 1).ToString("yyyyMM");
- //测试指定激活时间
- // TradeMonth = (int.Parse("202307") + i + 1).ToString();
- // TradeTime = (int.Parse("202307") + i + 1).ToString();
- var check = MerchantAmountSummayService.Query(" 1=1 and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
- if (check.Id > 0)
- {
- dic = MerchantAmountSummayService.Sum("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
- TradeAmount = decimal.Parse(dic["TradeAmount"].ToString());
- }
- //待考核
- if (int.Parse(DateTime.Now.ToString("yyyyMM")) < int.Parse(TradeTime))
- // if (int.Parse("202310") < int.Parse(TradeTime))//测试指定当前时间
- {
- Status = 0;
- }
- else
- {
- //考核中
- if (DateTime.Now.ToString("yyyyMM") == TradeTime)
- {
- Status = 1;
- }
- else
- {
- //已通过
- if (TradeAmount >= 10000 && check.Id > 0) Status = 2;
- //未通过
- if (TradeAmount < 10000 && check.Id >= 0) Status = -1;
- }
- }
- Dictionary<string, object> curData = new Dictionary<string, object>();
- curData.Add("TradeMonth", TradeMonth); //月份
- curData.Add("TradeAmount", TradeAmount); //订单金额
- curData.Add("Status", Status); //状态(-1 未通过 0 待考核 1 考核中 2 已通过 3 未参与)
- dataList.Add(curData);
- }
- }
- return dataList;
- }
- #endregion
- }
- }
|