using MySystem.MainModels; using Library; using MySystem.Service.Main; using System.Collections.Generic; using System; namespace MySystem { /// /// 商户业绩统计工具类 /// public class MerchantAmountSummayUtil { #region 已激活商户-达标信息列表 /// /// 已激活商户-达标信息列表 /// /// 商户Id /// 条数 /// 页数 /// public static List> ListDo(int MerchantId, int PageSize, int PageNum) { List> dataList = new List>(); var query = new MerchantDepositOrderService().QueryByMerchantId(MerchantId); if (query.Id > 0) { var month = DateTime.Parse(query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); var TradeMonth = ""; var TradeTime = ""; Dictionary dic = new Dictionary(); 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 = new MerchantAmountSummayService().QueryAmount("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + ""); if (check.Count > 0) { dic = new 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.Count > 0) Status = 2; //未通过 if (TradeAmount < 10000 && check.Count >= 0) Status = -1; } } Dictionary curData = new Dictionary(); curData.Add("TradeMonth", TradeMonth); //月份 curData.Add("TradeAmount", TradeAmount); //订单金额 curData.Add("Status", Status); //状态(-1 未通过 0 待考核 1 考核中 2 已通过 3 未参与) dataList.Add(curData); } } return dataList; } #endregion } }