MerchantAmountSummayUtil.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using MySystem.MainModels;
  2. using Library;
  3. using MySystem.Service.Main;
  4. using System.Collections.Generic;
  5. using System;
  6. namespace MySystem
  7. {
  8. /// <summary>
  9. /// 商户业绩统计工具类
  10. /// </summary>
  11. public class MerchantAmountSummayUtil
  12. {
  13. #region 已激活商户-达标信息列表
  14. /// <summary>
  15. /// 已激活商户-达标信息列表
  16. /// </summary>
  17. /// <param name="MerchantId">商户Id</param>
  18. /// <param name="PageSize">条数</param>
  19. /// <param name="PageNum">页数</param>
  20. /// <returns></returns>
  21. public static List<Dictionary<string, object>> ListDo(int MerchantId, int PageSize, int PageNum)
  22. {
  23. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  24. var query = new MerchantDepositOrderService().QueryByMerchantId(MerchantId);
  25. var Status = 0;//活动交易状态
  26. if (query.Id > 0)
  27. {
  28. var month = DateTime.Parse(query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
  29. var TradeMonth = "";
  30. var TradeTime = "";
  31. decimal TradeAmount = 0.00M;
  32. Dictionary<string, string> dic = new Dictionary<string, string>();
  33. for (int i = 0; i < 10; i++)
  34. {
  35. TradeMonth = month.AddMonths(i + 1).ToString("yyyy-MM");
  36. TradeTime = month.AddMonths(i + 1).ToString("yyyyMM");
  37. // TradeTime = (int.Parse("202308") + i + 1).ToString();
  38. var check = new MerchantAmountSummayService().QueryAmount("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
  39. if (check.Count > 0)
  40. {
  41. dic = new MerchantAmountSummayService().Sum("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "'");
  42. TradeAmount = decimal.Parse(dic["TradeAmount"].ToString());
  43. }
  44. //待考核
  45. if (int.Parse(DateTime.Now.ToString("yyyyMM")) < int.Parse(TradeTime))
  46. // if (int.Parse("202309") < int.Parse(TradeTime))
  47. {
  48. Status = 0;
  49. }
  50. else
  51. {
  52. //考核中
  53. if (DateTime.Now.ToString("yyyyMM") == TradeMonth) Status = 1;
  54. //已通过
  55. if (TradeAmount >= 10000 && check.Count > 0) Status = 2;
  56. //未通过
  57. if (TradeAmount < 10000 && check.Count > 0) Status = -1;
  58. }
  59. Dictionary<string, object> curData = new Dictionary<string, object>();
  60. curData.Add("TradeMonth", TradeMonth); //月份
  61. curData.Add("TradeAmount", TradeAmount); //订单金额
  62. curData.Add("Status", Status); //状态(-1 未通过 0 待考核 1 考核中 2 已通过 3 未参与)
  63. dataList.Add(curData);
  64. }
  65. }
  66. return dataList;
  67. }
  68. #endregion
  69. }
  70. }